[pygtk] Re: Get state of focus
Doug Quale
quale1 at charter.net
Tue Feb 6 23:50:22 WST 2007
Fabian Braennstroem <f.braennstroem at gmx.de> writes:
> My problem is now, that I don't know, how I can get the state of the
> focus of each treeview. Is there a function gtk to do that? I looked
> in the gtk.treeview reference and couldn't find any!?
>
> It is probably not the best way to achieve it, but my work around
> looks like counting the 'Tab' key strokes and if it is an even
> number, treeview 1 got the focus and if it is a odd number treeview
> 2 got the focus ... it kind of works, but there 'must' be a more
> elegant way!?
The focus stuff isn't in the treeview class. It's inherited from the
gtk.Widget and gtk.Object base classes. Inherited methods can be hard
to find in pygtk if you don't know where in hierarchy to look.
You should check if gtk.Object.flags() method and the gtk.HAS_FOCUS
flag or the gtk.Widget.is_focus() method gives you what you need.
--
Doug Quale
More information about the pygtk
mailing list