wxWindows off-screen?

Michele Petrazzo michele.petrazzoDELETE at DELETEunipex.it
Fri Jan 5 12:51:38 EST 2007


Ivan Voras wrote:
> Is it possible to draw a widget or a window in an off-screen buffer?

(Assuming that you are on linux.)

wxWigets (wxWindows is the old name) or better, since if you are on a
python ng, wxPython :), can't be used if you are on a not-X machine:

michele:~$ env | grep DIS
DISPLAY=:0.0
michele:~$ export DISPLAY=
michele:~$ env | grep DIS
DISPLAY=
michele:~$ python
Python 2.4.4 (#2, Oct 20 2006, 00:23:25)
[GCC 4.1.2 20061015 (prerelease) (Debian 4.1.1-16.1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx a = wx.PySimpleApp()
Unable to access the X Display, is $DISPLAY set properly?
michele:~$ echo $?
1
michele:~$

> What I'm trying to do is capture rendered HTML to a bitmap (in other 
> words, something like html2bitmap) by using wxWindows' HTML widget.
> If anyone has a different way of doing it, I'd be glad to hear it...

For me you have some solutions:
- open an X server (only X, you don't need gdm, kdm other), set the
   right DISPLAY env variable and use wx. Ok, you need (a lot of) memory,
   that in my tests are about 16 M for Xorg and 24 for python with wx,
   a wxFrame, wxPanel and some controls.
   Can be a good/the right solution for me.
- If I remember correctly, there are a project that "emulate" an X
   server (so the same that the X solution, but with less memory), but I
   don't know its name... Try to search on internet.
- Always with an X server, use a browser and with its api (pyxpcom for
   mozilla based, or dcop and pykde for konqueror and so on...), using
   the "print on a file" feature, so print a ps and convert it on an
   image.

Good try :), and not forgot to tell us your results!

Hope this help,
Michele



More information about the Python-list mailing list