(Get Maya Main Window for PyQt4/PySide)为PyQt4/PySide获取Maya的主窗口

阅读更多
我们都知道Maya的主窗口保存在mel的全局变量 $gMainWindow里。
We all know that wen can get the main Maya window with $gMainWindow.
print $gMainWindow;
//MayaWindow


因为Maya2011 和 Maya2012是使用Qt编写的界面,所以我们可十分轻松的获取Maya的主窗口。
Because the UI of Maya2011 and Maya2012 was based on Qt, os we can super easy to get the main window.
#from PyQt4 import QtGui
from PySide import QtGui

for widget in QtGui.qApp.allWidgets():
    print widget.objectName()

引用
......
qt_scrollarea_viewport
selectedDispLayer

ShadedBtn
iconTextCheckBox4
formLayout20
tabLayout2

MayaWindow
qt_dockwidget_floatbutton
HotboxEast2
formLayout5


popupMenu48
selectButton3

objPickMenuIcon
......

你可能感兴趣的:(qt,maya,python)