Here is the code open.py (main file) that opens a login page that has a button which when clicked closes the login page and opens a menu page:
from PyQt4 import QtGui
import sys
from loginpage import Ui_loginPage
from menu import Ui_Menu
class Form1(QtGui.QWidget, Ui_loginPage):
def __init__(self,parent=None):
QtGui.QWidget.__init__(self,parent)
self.setupUi(self)
self.login.clicked.connect(self.handleButton)
self.window2 = None
def handleButton(self):
self.close()
if self.window2 is None:
self.window2 = menu(self)
self.window2.show()
sys.exit(app.exec_())
class menu(QtGui.QWidget, Ui_Menu):
def __init__(self,parent=None):
QtGui.QWidget.__init__(self,parent)
self.setupUi(self)
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
window = Form1()
window.show()
sys.exit(app.exec_())
The code runs fine without any error, but when i click the login button, the login page closes but the menu page doesn't appear. It just doesn't show at all.