我在 pyqt 中制作了一些页面,然后在 python 中对其进行了编辑。
我假设有 3 页,我希望这个程序运行 3 次,这意味着 page1 到 page2 到 page3 到 page1。我使用“下一步”按钮连接每个页面。
我尝试了循环。这是我的代码不起作用。
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from test import *
app = QApplication(sys.argv)
window = QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(window)
for i in range(3):
def find_page():
ui.stackedWidget.childern()
window.visible = ui.stackedWidget.currentIndex()
def next():
ui.stackedWidget.setCurrentIndex(ui.stackedWidget.currentIndex()+1)
print(window.visible)
ui.next.clicked.connect(next)
window.show()
sys.exit(app.exec_())