|FAQ Index - Search - Recent Changes - Everything - Add entry|
5.12. How do I check if a widget is mapped? And realized? And visible? [...]
All gtkWidget's have a number of flags that indicate their state. PyGTK offers a method that can be used together with a number of gtk symbols to retrieve this state from the widget.
In PyGTK the method is called flags(), and it doesn't take arguments, so you must perform the binary AND yourself:
# To check if `widget' is mapped: if widget.flags() & gtk.MAPPED: print "MAPPED!"There are a number of flags you can test for. The following are defined in the gtk namespace:
# gtk.Object DESTROYED FLOATING CONNECTED CONSTRUCTED # gtk.Widget TOPLEVEL NO_WINDOW REALIZED MAPPED VISIBLE SENSITIVE PARENT_SENSITIVE CAN_FOCUS HAS_FOCUS CAN_DEFAULT HAS_DEFAULT HAS_GRAB RC_STYLE COMPOSITE_CHILD BASIC APP_PAINTABLE RECEIVES_DEFAULT