如果我将窗口设置为 showMaximize(),PyQt 不会显示按钮如果我设置了 self.setGeometry(50, 50, 500, 300) 那么 Button 在 showMaximized() 处显示完美面对问题import sysfrom PyQt4 import QtGui, QtCoreclass Window(QtGui.QMainWindow): def __init__(self): super(Window, self).__init__() self.showMaximized() self.setWindowTitle("PyQT tuts!") self.setWindowIcon(QtGui.QIcon('pythonlogo.png')) self.home() def home(self): btn = QtGui.QPushButton("Quit", self) btn.clicked.connect(QtCore.QCoreApplication.instance().quit) btn.resize(100, 100) btn.move(100, 100) self.show()def run(): app = QtGui.QApplication(sys.argv) GUI = Window() sys.exit(app.exec_())run()任何帮助,将不胜感激 ,我需要将 Button 放在我的 Window 的中心。
添加回答
举报
0/150
提交
取消