import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class MainWindow(QMainWindow):
EXIT_CODE_REBOOT = -123
#constructor
def __init__(self):
super().__init__() #call super class constructor
#above is the constructor ^^^^^^^^^^^
self.HomePage() #this goes to the homepage function
def HomePage(self):
#this layout holds the review question 1
self.quit_button_11 = QPushButton("restart", self)
self.quit_button_11.clicked.connect(self.restart)
def restart(self): # function connected to when restart button clicked
qApp.exit( MainWindow.EXIT_CODE_REBOOT )
if __name__=="__main__":
currentExitCode = MainWindow.EXIT_CODE_REBOOT
while currentExitCode == MainWindow.EXIT_CODE_REBOOT:
a = QApplication(sys.argv)
w = MainWindow()
w.show()
currentExitCode = a.exec_()
a = None # delete the QApplication object
How to restart this code ?