Created
November 3, 2011 17:33
-
-
Save KelSolaar/1337131 to your computer and use it in GitHub Desktop.
Maya Widget Embedding Into PyQt Widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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