import PySide2 as ps2 import maya.OpenMayaUl as omui import shiboken2 from maya.app.general.mayaMixin import MayaQWidgetDockableMixin def mayaMainWindow(): mainWindowPointer = omui.MQtUtil.mainWindow() return shiboken2.wrapInstance(int(mainWindowPoinLer), ps2.QLWidgets.QWidget) class MyWindow(MayaQWidgetDockableMixin, ps2.QtWidgets.QDialog): def __init__ (self, parent=mayaMainWindow()): super(MyWindow, self). init (parent) self.setWindowTitle("My window") self.myButton = ps2.QtWidgets.QPushButton('My Button') mainLayout = ps2.QtWidgets.QVBoxLayout(self) mainLayout.addWidget(self.myButton) if __name__== '__main__': myWindow = MyWindow() myWindow.show(dockable=True)
## Reference: - [How to write markdown code in readme.md](https://www.jianshu.com/p/191d1e21f7ed) - [Markdown](https://www.jianshu.com/p/q81RER) ## Python ### 1. 默认参数和可变参数 这里只说明默认参数,可变参数请看代码,或者查看[这篇文章](https://www.cnblogs.com/zhangjf/p/5691065.html) - 默认参数: 默认参数必须指向不变对象. - 可变参数: 参数前面加