Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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()
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment