是否可以在1 .py文件中使用2个PyQT UI?
示例代码:
Class a(object):
*insert code for PyQT First UI
Class b(QMainWindow):
*insert code for PyQT Second UI
a类首先运行,但我如何从A类切换到B类反之亦然?
答案 0 :(得分:0)
如果你想拥有两个窗口并且能够切换到其中任何一个窗口,你只需在主文件中声明它们:
def main_Window_A(QMainWindow):
# code for window A
def main_window_B(QMainWindow):
# code for window B
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
window_A = main_Window_A()
window_A.show()
window_B = main_Window_B()
window_B.show()
sys.exit(app.exec())