Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Setting X properties in tkinter or wxPython

Reply
Thread Tools

Setting X properties in tkinter or wxPython

 
 
Thorkild Stray
Guest
Posts: n/a
 
      06-22-2004
Hi!

I am trying to embed ghostscript into a suitable widget so that it renders
it's image there.

This is support by ghostscript by setting an environment variable that
indicates what window you want it to write to, and then setting a property
on that window (aptly named "GHOSTVIEW"). I am having problems finding a
way of adding this X property. I've tried both wxPython and tkinter
(pygtk2 wouldn't easily give me the x window id without patching it), but
I can't find a suitable way of adding such a property.
Ghostscript needs to read information from that property before drawing
the contents.

Anybody got an idea?

--
Thorkild
 
Reply With Quote
 
 
 
 
Chris King
Guest
Posts: n/a
 
      06-23-2004
> 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
(http://python-xlib.sourceforge.net/). 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.
 
Reply With Quote
 
 
 
 
Thorkild Stray
Guest
Posts: n/a
 
      06-24-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
> (http://python-xlib.sourceforge.net/). 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
property).

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:

http://www.daa.com.au/pipermail/pygt...ch/004641.html

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.

--
Thorkild

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting properties (not necessarily "Properties") in Java 5.0 Wardie Java 4 11-08-2006 09:46 AM
[wxPython-users] Web based applications are possible with wxPython? Ruben Charles Python 6 10-25-2005 09:41 PM
wxPython - wx package (new style wxPython?) Logan Python 5 12-11-2003 04:12 PM
[PY GUI] interest function in python GUI(wxpython,pyqt) program.wxpython,pyqt ulysses Python 4 10-22-2003 03:28 PM
wxPython looses function "wxPython.wx.miscc" Anand Python 1 07-23-2003 01:59 AM



Advertisments