class Window(QtGui.QMainWindow):
def __init__(self):
super(Window, self).__init__()
def new(self):
newFile = Window()
newFile.show()
I didn't show the full code becuase it's too long.I have tested that is the window
created or not by using print and the window is actually created but it closes immediately
As it stands, newFile
only exists within the scope of the new()
function. You need to store the instance that you create or it will get garbage collected.
self.newFile = Window()
self.newFile.show()