Skip to content

Instantly share code, notes, and snippets.

@whoiscarlo
Created August 25, 2015 18:28
Show Gist options
  • Save whoiscarlo/128b1687e70cd0b27c69 to your computer and use it in GitHub Desktop.
Save whoiscarlo/128b1687e70cd0b27c69 to your computer and use it in GitHub Desktop.
Get Maya Window for PyQt and PySide
# PyQt
import sip For pyQt
from PyQt4 import QtGui
try:
import maya.OpenMayaUI as mui
ptr = mui.MQtUtil.mainWindow()
parent = sip.wrapinstance(long(ptr), QtCore.QObject) PyQt
except:
parent = None
thisUI(parent=parent)
## For PySide
import shiboken
from PySide import QtGui
try:
import maya.OpenMayaUI as mui
ptr = mui.MQtUtil.mainWindow()
parent = shiboken.wrapInstance(long(ptr), QtGui.QWidget)
except:
parent = None
thisUI(parent=parent)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment