[pygtk] Window existance

Russell Shaw rjshaw at iprimus.com.au
Sun Feb 15 20:01:07 WST 2004


Michal Pasternak wrote:
> Russell Shaw [Sun, Feb 15, 2004 at 07:06:10PM +1100]:
> 
>>Hi,
...
>>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

Hi,
I get this error:

   File "db.py", line 81, in get_table
       if self.window != None:
   AttributeError: Edit_Manufs instance has no attribute 'window'

However, i figured out this way:

   if 'window' in dir(self):
     self.window.destroy()


More information about the pygtk mailing list