[pygtk] How do I find out if a widget is viewable?

John Ehresman jpe at wingware.com
Sat Oct 14 05:43:57 WST 2006


David Hirschfield wrote:
> I asked this question a little while back, but didn't really get any 
> response...I try asking it better:
> 
> I'm looking for the simplest way to determine if a displayed pygtk 
> widget is "viewable" (not the same thing as "visible" as I explain below).
> By "viewable" I mean that the user is actually able to see some or all 
> of the widget's extent (the rectangle enclosing the widget on screen) 
> when they are looking at the window the widget is in.

I think you want gdk.Drawable.get_visible_region  Use get_visible_region 
on the gdk window attached to the widget and adjust for the widget's 
allocation.  Note that this method does not take into account other 
toplevel windows that may obscure the widget, but I don't think you want 
it to.

Cheers,

John


More information about the pygtk mailing list