【发布时间】:2013-01-23 04:47:43
【问题描述】:
我使用 QT Designer 在 PyQT 中创建了许多 GUI 界面,但现在我试图从另一个界面打开一个界面,但我不知道该怎么做。 Start.py是运行GUI界面Authentification_1的文件,Acceuil_start.py是运行GUI界面Acceuil_2的文件。 py,现在我想从 Start.py 到午餐 Acceuil_start.py。 你对此有什么想法吗?谢谢你。 这是我的代码:
开始.py:
import sys
from PyQt4 import QtCore, QtGui
from Authentification_1 import Ui_Fenetre_auth
from Acceuil_2 import Ui_MainWindow #??? Acceuil_2.py is the file which I want to open
class StartQT4(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_Fenetre_auth()
self.ui.setupUi(self)
def authentifier(val): #Slot method
self.Acceuil = Acceuil() #???
self.Acceuil.show() #???
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = StartQT4()
myapp.show()
sys.exit(app.exec_())
Acceuil_start.py
import sys
from PyQt4 import QtCore, QtGui
from Authentification_1 import Ui_Fenetre_auth
from Acceuil_2 import Ui_MainWindow
class StartQT4(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = StartQT4()
myapp.show()
sys.exit(app.exec_())
【问题讨论】:
标签: python qt python-3.x pyqt pyqt4