Skip to content

Instantly share code, notes, and snippets.

@Kif11
Last active October 16, 2023 04:55
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kif11/cdd4a68a2133aa42a582 to your computer and use it in GitHub Desktop.
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')
@lalamax3d
Copy link

thanks, can you please show an altered version.
a- loading UI via Qloader .ui file and set it as window or central widget. huge thanks in advance.

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