Dear Brian,
How do you import wxPython in your cgi? With from wxPythin.wx import * or do
you import the modules you need in your script separately?
Oliver
···
-----Ursprüngliche Nachricht-----
Von: Brian Kelley [mailto:bkelley@wi.mit.edu]
Gesendet: Freitag, 5. Dezember 2003 22:32
An: wxPython-users@lists.wxwindows.org
Betreff: Re: [wxPython-users] wxDC - Standalone and with CGI?
Robin Dunn wrote:
Oliver Walczak wrote:
Dear List,
Is it possible to use wxPython in a server sided CGI script?No, wxWidnows needs access to the UI in order to be initialized.
That still doesn't prevent it from being used in a cgi script. I use
wxDC's from a python apache server all the time. The trick is not to
open up an gui windows. These tend to annoy anyone looking at the server.
I have a drawer class that draws on a wxMemoryDC() and saves the file to
disk as a "gif"
Here is a small snippet to give you a taste.
class Drawer:
def save(self, filename):
dc = wxMemoryDC()
bmp = wxEmptyBitmap(width, height)
dc.SelectObject(bmp)
self._draw(dc)
bmp.SaveFile(filename, type)
usage...
app = wxPySimpleApp()
wxInitAllImageHandlers()
d = Drawer(...)
d.save(filename)
This app sets up the gui environment and writes out a gif file. I think
it can be used in a cgi environment, otherwise you can call this from
your cgi script.
Brian
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org