[pygtk] Window existance
Michal Pasternak
michal at pasternak.w.lub.pl
Sun Feb 15 09:12:00 WST 2004
Russell Shaw [Sun, Feb 15, 2004 at 07:06:10PM +1100]:
> Hi,
>
> In a class, i have:
>
> self.window=gtk.Window(gtk.WINDOW_TOPLEVEL)
>
> Later on, there is:
>
> if(self.window)
> self.window.destroy()
>
> I get an error:
>
> File "db.py", line 82
> if(self.window)
> ^
>
> How do i test that the window exists? (or that a pointer is not null)
Python doesn't have "null pointers". You should do:
if self.window is not None:
or:
if self.window != None:
instead. Python tutorial is here:
http://python.org/doc/current/tut/tut.html
More information about the pygtk
mailing list