How to generate graphics dynamically on the web using Python CGI script?
rphillips at engineer.co.summit.oh.us
Mon Jan 23 06:47:47 EST 2006
Steve Holden wrote:
> Debashis Dey wrote:
> > Hello,
> > I have a python CGI program. I would like to show a graph within a HTML
> > plage. I would like to dynamically generate the graph using the python
> > CGI script on the web server side and send it to the browser.
> > My question is how can I do this in python? Is there a free tool to do
> > this? Can someone please send me some simple python code to draw simple
> > graphics within HTML (e.g. draw a line or a circle).
> Unfortunately HTML does not include graphics facilities, simply the
> ability to refer to graphical resources.
> The typical way to include a created graphic would be:
> 1. Create a (.png, .jpg, .gif) file showing the
> image you want
> 2. Store it in a temporary file whose name will be
> unique to the current session
> 3. Generate an HTML response including an <IMG ...>
> tag referring to the newly created graphic
SVG might be suitable; Firefox supports a reasonable subset of SVG out
of the box, and even IE supports it through an Adobe plugin.
If the OP is intending the page for a specific group of users, it could
be a very simple solution.
More information about the Python-list