Skip to content

Instantly share code, notes, and snippets.

@KelSolaar
Created November 3, 2011 17:33
Show Gist options
  • Save KelSolaar/1337131 to your computer and use it in GitHub Desktop.
Save KelSolaar/1337131 to your computer and use it in GitHub Desktop.
Maya Widget Embedding Into PyQt Widget
import maya.OpenMayaUI
import maya.cmds as cmds
import sip
from PyQt4.QtGui import *
from PyQt4.QtCore import *
mainWindow = QMainWindow()
centralWidget = QListView()
mainWindow.setCentralWidget(centralWidget)
dockWidget = QDockWidget("DockWidget", mainWindow)
dockWidget.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
mayaMainWindow = sip.wrapinstance(long(maya.OpenMayaUI.MQtUtil.mainWindow()), QObject)
channelBoxDockWidget = None
widget = cmds.attrColorSliderGrp("__MyWidget__")
dockWidget.setWidget([widget for widget in mayaMainWindow.findChildren(QWidget, "__MyWidget__")][0])
mainWindow.addDockWidget(Qt.DockWidgetArea(Qt.LeftDockWidgetArea), dockWidget)
mainWindow.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment