Apr-09-2019, 08:17 AM
I have a Main Window with a button which imports a Second Window.
The Second Window has a Home button which imports the Main Window.
When the Second Window button in the Main Window is clicked, the Second Window is displayed. When the Home button in the Second Window is clicked the Main Window is displayed.
When the Second Window button in the Main Window is clicked again the program hangs.
Can someone please tell me why this happens?
The Second Window has a Home button which imports the Main Window.
When the Second Window button in the Main Window is clicked, the Second Window is displayed. When the Home button in the Second Window is clicked the Main Window is displayed.
When the Second Window button in the Main Window is clicked again the program hangs.
Can someone please tell me why this happens?
#Displays Main window import sys, os from PyQt4 import QtCore, QtGui, uic win1 = uic.loadUiType("MainWin.ui")[0] class UserWindow(QtGui.QMainWindow, win1): def __init__ (self,parent=None): QtGui.QMainWindow.__init__(self,parent) self.setupUi(self) self.SecondWinBtn.clicked.connect(self.SecondWin) self.SignOutBtn.clicked.connect(self.LogOut) def LogOut(self): self.close() def SecondWin(self): import pyqtSecondWin self.close() def LogOut(self): self.close() app=QtGui.QApplication(sys.argv) Win1=UserWindow(None) Win1.show() app.exec_()
#shows Second window import sys, os from PyQt4 import QtCore, QtGui, uic win1 = uic.loadUiType("SecondWin.ui")[0] class OverdueWindow(QtGui.QMainWindow, win1): def __init__ (self,parent=None): QtGui.QMainWindow.__init__(self,parent) self.setupUi(self) self.SignOutBtn.clicked.connect(self.LogOut) self.HomeBtn.clicked.connect(self.DisplayMainWin) def LogOut(self): self.close() def DisplayMainWin(self): import pyqtDisplayMainWin self.close() app=QtGui.QApplication(sys.argv) Win1=OverdueWindow(None) Win1.show() app.exec_()