[Edu-sig] More on graphics with graphics.py (Zelle's)

kirby urner kirby.urner at gmail.com
Mon Feb 12 21:28:53 CET 2007


Some of you old timers may recall a project in May, 2004 to implement
Wolfram's minimalist cellular automaton experiments using a Tk canvas
and/or PIL.

As I recall, John showed us how to speed it up a whole lot by passing
some 'False' parameter in the GraphWin call.

However, now that I'm testing the code, in preparation for this post, lo
these many years later (on a faster computer in a different version of
Python (2.5)), and with a newly downloaded graphics.py, I'm seeing
those rows of the Mayan Pyramid, associated with Wolfram's "Rule 30" [1],
run across the screen like some raster beam on an ultra slow TV.

http://mail.python.org/pipermail/edu-sig/2004-May/003866.html

In any case, the code isn't all the beautiful, could be streamlined, but
consists of nks.py atop two possible Canvas objects, one in Tk, one
in PIL (Python's Imaging Library -- could be a jpeg).

http://www.4dsolutions.net/ocn/python/nks.py  <-- Wolfram's rules 0-255
(computed)
 http://www.4dsolutions.net/ocn/python/canvas1.py <- PIL canvas
 http://www.4dsolutions.net/ocn/python/canvas2.py <- Tk canvas

Kirby

PS:  I haven't tested the PIL version for 2.5 yet, seein' as all the recent
traffic has been about using Tk.

PPS:  this code isn't procedural though, may not be suitable for CS0
within the United States (a math phobic distopia, except in patches)

[1] http://mathworld.wolfram.com/Rule30.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/edu-sig/attachments/20070212/45ffa58d/attachment-0001.html 


More information about the Edu-sig mailing list