nuke 窗口置顶
#!/usr/bin/env python# -*- coding:utf-8 -*-import sysimport osimport tracebackimport timetry:from PySide2 import QtWidgets as QtGuifrom PySide2 import QtGui as QtGui1from PySide...
·
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import os
import traceback
import time
try:
from PySide2 import QtWidgets as QtGui
from PySide2 import QtGui as QtGui1
from PySide2 import QtCore
except ImportError:
from PySide import QtGui
from PySide import QtCore
class TreeViewOne(QtGui.QTreeWidget):
def __init__(self,parent=None):
super(TreeViewOne,self).__init__(parent=parent)
self.setHeaderLabels([u'项目'])
class TreeViewTwo(QtGui.QTreeWidget):
def __init__(self,parent=None):
super(TreeViewTwo,self).__init__(parent=parent)
self.setHeaderLabels([u'场次'])
class ImportNukeUI(QtGui.QDialog):
parentUI=QtGui.QApplication.activeWindow()
def __init__(self, parent=parentUI):
super(ImportNukeUI,self).__init__(parent)
self.setWindowTitle('nuke_data_Preview')
self.resize(420,391)
self.initUI()
def initUI(self):
self.tree_one=TreeViewOne()
self.tree_two=TreeViewTwo()
pro_path=QtGui.QLabel(u"路径")
self.pro_path_edit=QtGui.QLineEdit()
self.import_button=QtGui.QPushButton(u"导入")
self.exit_button=QtGui.QPushButton(u"退出")
lay1=QtGui.QHBoxLayout()
lay1.addWidget(self.tree_one)
lay1.addWidget(self.tree_two)
lay2=QtGui.QHBoxLayout()
lay2.addWidget(pro_path)
lay2.addWidget(self.pro_path_edit)
lay3=QtGui.QHBoxLayout()
lay3.addStretch(1)
lay3.addWidget(self.import_button)
lay3.addWidget(self.exit_button)
Layt=QtGui.QVBoxLayout()
Layt.addLayout(lay1)
Layt.addLayout(lay2)
Layt.addLayout(lay3)
self.setLayout(Layt)
if __name__ == '__main__':
import sys
#app = QtGui.QApplication(sys.argv)
dialog = ImportNukeUI()
dialog.show()
#sys.exit(app.exec_())
同理,如果不置顶,有些常用的窗口使用起来很不方便。
parentUI=QtGui.QApplication.activeWindow()
def init(self, parent=parentUI)
在这里写上父窗口的名字之后,它就会依附于父窗口了。
提醒:主窗口必须继承 QDialog,如果继承QWidget会镶嵌于主窗口。
更多推荐
已为社区贡献7条内容
所有评论(0)