簡單的 UI 範例 :
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin
from PySide import QtCore, QtGui
class MyWidget(MayaQWidgetDockableMixin,QtGui.QWidget):
def __init__(self,parent=None):
super(MyWidget, self).__init__(parent=parent)
self.setWindowTitle("my widget")
layout = QtGui.QVBoxLayout()
self.setLayout(layout)
btn1 = QtGui.QPushButton("run this")
layout.addWidget(btn1)
btn2 = QtGui.QPushButton("run that")
layout.addWidget(btn2)
spacer = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
layout.addSpacerItem(spacer)
newWidget = MyWidget()
newWidget.show(dockable=True)
效果:
Maya PySide UI 參考資料:
沒有留言:
張貼留言