Setting X properties in tkinter or wxPython (solved in Gtk2)

Thorkild Stray thorkild at
Thu Jun 24 04:54:16 CEST 2004

Den Wed, 23 Jun 2004 11:41:43 -0700, skrev Chris King:

>> Anybody got an idea? 
> I'm not very familiar with wxPython, but it seems that even native Tk
> can't set window properties (though the Tk C library can). Perhaps an
> alternative is to use python-xlib
> ( I'm even less familiar with
> that, but the functions Display.create_resource_object and
> Window.change_property look useful. Note that the Tk C library warns
> against using native X calls in place of its functions.

Yes, I thought about using python-xlib, or maybe just python-ctypes, but
I am a little bit nervous about getting it to things correctly according
to the GUI-package.

I managed to do what I wanted with GTK2, though. I prototyped it in
Gtk2-perl, but the same should be doable in PyGTK2 (the correct way of
doing it is to call gtk.gdk.Window.property_change() to set the raw X

My problem with PyGTK2 is the surprising problems I am having with getting
a hold of the window X identifier. It seems that they removed
gtk.gdk.window.xid somewhere between 1.99 and 2.0, and just added it back
in the 2.3-series (I believe it was added 20th of April, 2004).

There is a patch available on how to enable this for older versions
described at:

My problem is that I would either have to demand that the user patches his
pygtk2 (not likely), or to demand that they install bleeding edge
unstable versions of pygtk2. So now I am looking for a way around this..
Maybe I could either do it in embedded C, or by calling xwininfo on the
window and find it there.. both quite ugly workarounds. :-(


More information about the Python-list mailing list