View Single Post
daperl's Avatar
Posts: 2,427 | Thanked: 2,986 times | Joined on Dec 2007
#7
Originally Posted by luis View Post
Just a question: how do you check if a widget is a container?

Thanks,
L.
The appended script returned:
Code:
yes
yes
no
and it should be robust.

Code:
import gobject
import gtk

myContainer = gtk.Window()
if gobject.type_is_a(myContainer,gtk.Window):
  print 'yes'
else:
  print 'no'
if gobject.type_is_a(myContainer,gtk.Container):
  print 'yes'
else:
  print 'no'
if gobject.type_is_a(myContainer,gtk.Label):
  print 'yes'
else:
  print 'no'
__________________
N9: Go white or go home