0
如何在默認情況下以全屏啓動小部件?試圖添加setWindowState但失敗。如何在啓動時最大化QWidget
這裏是代碼:
class Main (QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
self.ui = Ui_Form()
self.ui.setupUi(self)
self.ui.setWindowState(QtCore.Qt.WindowMaximized)
#error: 'Ui_Form' object has no attribute 'setWindowState'
self.ui.btn1.clicked.connect(self.btn1_clicked)
self.ui.btn2.clicked.connect(self.btn2_clicked)
def btn1_clicked(self):
global value1
value1 += 1
self.ui.num1.setText("%d" %value1)
def btn2_clicked(self):
global value2
value2 += 1
self.ui.num2.setText("%d" %value2)
嘗試使用showMaximized() – Pratham 2014-10-10 08:31:01
謝謝Pratham ..它的工作原理! – YTL4110 2014-10-10 13:24:52
@ YTL4110:將其添加爲答案 – Pratham 2014-10-10 13:28:25