[Python-talk] Roses update - new images and a simple PyChart version
Ric Werme
ewerme at comcast.net
Mon Jun 4 10:32:26 EDT 2007
I've made some significant improvements to my
http://wermenh.com/roses/index.html page. It now features a couple
dozen images of roses to help show how you go from a simple but
attractive curve to something really neat.
I've also added links to
1) my original Python roses program that used tkinter,
2) a new version that uses tkinter and clroses.py,
3) another new program that uses PyChart and clroses.py.
I used 3) to create the new images on the main page.
I decided to barge ahead and write the PyChart version now instead of
waiting for a PySig talk on it. There's not much to using it for simple
stuff, in fact, the meat is:
if not filename:
filename = 'rose%dx%d.png' % (style, petal)
can = canvas.init(filename)
thin_line = line_style.T(width = .1)
white_line = line_style.T(color = color.white)
# Many images don't reach (x,y) = (-1,0), and PyChart or GhostView seems to
# want to "optimize" the image area. The following seems to force things to
# display the whole domain.
can.rectangle(white_line, None, 0, 0, width, width, shadow=None)
# Complains about pcroses options: theme.get_options()
# There are many links between clroses and the application, but we
# need none of them, so we can use clroses directly.
rose = clroses.rose()
upoints = rose.rose(style, petal, vectors)
spoints = rose.rescale(upoints, (0, 0), width/2)
ar = area.T(x_range=(-width/2, width/2), size = (width, width),
y_range=(-width/2, width/2), y_grid_style = None, legend = None)
plot = line_plot.T(data=spoints, ycol=1, line_style=thin_line)
ar.add_plot(plot)
# Draw everything
ar.draw()
This does not mean I'm qualified to talk about PyChart, but given that I'm
barely qualified to talk about wxPython, that's not surprising.
-Ric Werme
More information about the Python-talk
mailing list