I am trying to create a tab system UI in maya, using pyside2, but I am having some trouble.
I have already tried a alot of different ways, but still no results.
Can someone let me know how to create one? Just a super small example.
Thank you all! Cheers
Here is a simple example
from PySide2.QtCore import *
from PySide2.QtWidgets import *
from PySide2.QtGui import *
from shiboken2 import wrapInstance
from maya import OpenMayaUI as omui
def getMayaWindow():
mayaMainWindowPtr = omui.MQtUtil.mainWindow()
mayaMainWindow = wrapInstance(long(mayaMainWindowPtr), QWidget)
return mayaMainWindow
class TabExample(QMainWindow):
def __init__(self, parent = None):
super(TabExample, self).__init__(parent)
self.setWindowTitle("Tab Widget")
tab = QTabWidget()
button = QPushButton("Tab One!")
textEdit = QTextEdit()
textEdit.setPlaceholderText("Tab Two!!")
tab.addTab(button, "Tab One")
tab.addTab(textEdit, "Tab Two")
self.setCentralWidget(tab)
self.show()
tabWindow = TabExample(parent=getMayaWindow())
1 Like
fuzesmarcell:
def getMayaWindow():
mayaMainWindowPtr = omui.MQtUtil.mainWindow()
mayaMainWindow = wrapInstance(long(mayaMainWindowPtr), QWidget)
return mayaMainWindow
class TabExample(QMainWindow):
def __init__(self, parent = None):
super(TabExample, self).__init__(parent)
self.setWindowTitle("Tab Widget")
tab = QTabWidget()
button = QPushButton("Tab One!")
textEdit = QTextEdit()
textEdit.setPlaceholderText("Tab Two!!")
tab.addTab(button, "Tab One")
tab.addTab(textEdit, "Tab Two")
self.setCentralWidget(tab)
self.show()
tabWindow = TabExample(parent=getMayaWindow())
Thank you so much man!
You saved my life
Truly appreciate!
Cheers
1 Like