Upon calling the show method on simple the simple window does not show. Why doesn\'t my Simple window show. :(
import sys
from PyQt4 import QtGui
class Wid
The problem with your code is that, simple
in __init__
method of class Widget
is a local variable, so as soon as the __init__
method finishes execution, the simple
object is destroyed by the python Garbage Collector, thus the window does not appear because the object does not exist in the memory. To solve your problem, just add self
at the starting of the simple
variable to make it member variable.
...
self.simple = Simple()
button = QtGui.QPushButton("Button", self)
button.clicked.connect(self.simple.show)
...