[pygtk] how do I get a list of windows on my desktop?

John Accoun jsonacc at gmail.com
Thu Mar 15 16:27:27 WST 2012


None of these work:

============================
>>> gtk.gdk.window_get_toplevels()
[<gtk.gdk.Window object at 0xb74339b4 (GdkWindow at 0x8a4c170)>]

>>> gtk.gdk.window_get_toplevels()[0].get_children()
[]
============================


============================
>>> d = gtk.gdk.DisplayManager()
>>> d.get_default_display().get_screen(0).get_root_window().get_children()
[<gtk.gdk.Window object at 0x89dcc84 (GdkWindow at 0x8a4c170)>,
<gtk.gdk.Window object at 0x89dccac (GdkWindow at 0x8a4c0c0)>]
============================

The second method returns two windows with no children, regardless the
amount of windows I have on my desktop. Could anyone point me the
right direction and explain why none of the above does what I want?


More information about the pygtk mailing list