Skip to content

Instantly share code, notes, and snippets.

@Kif11
Last active September 21, 2024 10:59
Show Gist options
  • Select an option

  • Save Kif11/cdd4a68a2133aa42a582 to your computer and use it in GitHub Desktop.

Select an option

Save Kif11/cdd4a68a2133aa42a582 to your computer and use it in GitHub Desktop.
PyQt scaffold for creating dockable Maya window
from PySide import QtCore
from PySide import QtGui
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin
class MainWindow(MayaQWidgetDockableMixin, QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent=parent)\
# Main widget
main_widget = QtGui.QWidget()
main_layout = QtGui.QVBoxLayout()
# Create UI widgets
self.test_btn = QtGui.QPushButton('Test')
# Attach widgets to the main layout
main_layout.addWidget(self.test_btn)
# Set main layout
main_widget.setLayout(main_layout)
self.setCentralWidget(main_widget)
# Connect buttons signals
self.test_btn.clicked.connect(self.on_test_btn_click)
def on_test_btn_click(self):
print 'Test button was clicked'
def main():
w = MainWindow()
w.show(dockable=True, floating=False, area='left')
@luckyfelix23
Copy link

luckyfelix23 commented Sep 21, 2024

@hannesdelbeke great works, but how do you create this using maya.cmds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment