Edmund Lian wrote:
> Has anybody had any experience generating business-style charts on-the-fly
> from within Webware? If so, what did you use? I see a few packages like
> Dislin, GNUPlot, etc., but before messing around, I thought I should ask
> for experiences. This topic area probably needs to be added to the Wiki; I
> can do so once I get enough responses...
>
> ...Edmund.
>
I sent an e-mail on pygd for graphics a few months ago, but I don't
know if it does business charts:
-------- Original Message --------
Subject: Using python-gd for graphics
Date: Wed, 01 May 2002 14:45:30 +0200
From: Bill Eldridge <bill@...>
Organization: Radio Free Asia
To: webware <webware-discuss@...>
I started playing with the python wrapper for gd from
http://www.boskant.nl/geert/Software/
and it seems to work well with Webware - as an example:
class PNG(ExamplePage):
import gd,sys,time
def writeHTML(self):
img = gd.Image(300, 200, truecolor=1)
pnt = gd.Painter(img)
pnt.setPen(gd.Pen(gd.RGBA(0, 0, 0)))
pnt.setBrush(gd.Brush(gd.RGBA(0,255,255)))
pnt.drawRectangle((0, 0), 300, 200)
font = gd.Font('mediumbold')
pnt.setFont(font)
pnt.drawText((65, 100), time.ctime(time.time()))
img.save(self,format='png')
where "img.save" nicely grabs the write method of self.
I access this from another page with:
self.writeln('<p> <img src="/WK/PNG">\n')
which works for both png & jpeg
I am curious though why I don't need to output
"Content-type: img/jpg\n\n"
from my PNG.py script which I do when outputting
from an Apache cgi.
--
Bill Eldridge
Radio Free Asia
bill@...
|