[pygtk] Signal handlers and hanging references
John Ehresman
jpe at wingware.com
Wed Mar 5 04:42:11 WST 2008
Tero Saarni wrote:
> I have a python object owning a widget and implementing a signal
> handler, lets say:
>
> class MyObject:
> ...
> self.button = gtk.Button(title)
> self.button.connect('clicked', self.on_clicked, None)
> ...
>
> Deleting instances of MyObject does not have effect until the signal
> handler is disconnected (either by calling disconnect or by deleting
> self.button).
Short answer is you probably need to make sure your widget is destroyed
at the appropriate time. Otherwise learn about the garbage collector
and how it works. Note also that del in python does not delete the
object, rather it deletes the binding from a variable or attribute name
to an object (you may or may not know this, it's unclear from your
problem description).
Cheers,
John
More information about the pygtk
mailing list