[Edu-sig] Edu-sig Digest, Vol 31, Issue 16
Radenski, Atanas
radenski at chapman.edu
Wed Mar 1 03:20:42 CET 2006
My experience with turtle graphics in a CS1 course has been very
rewarding. It allows *everyone*, not just the most motivated, to be
creative. With turtle, drawing an original and intersting design is so
easy. In a couple of dozens of lines, my CS1 students create some
amazing designs - every semester brings more and more gems. Students use
turtle to draw fractals and then concentric figures that change colors
and are constantly redrawn.
Of course, turtle is not fast and it is not fancy as programming, and it
behaves badly in Windows, but the important thing is that it really
inspires almost all beginners to learn and do more. My students post
their turtle graphics designs in course Forums and they are so proud -
for good reason.
Consider for example this simple program:
# Pattern Designer
import turtle;
# Create a blue pen and determine the window's width and height:
def init():
pen = turtle.Pen();
pen.color(0, 0, 1); # blue
width = pen.window_width();
height = pen.window_height();
return pen, width, height;
# Given a number, design a pattern for that number:
def pattern(number):
pen, w, h = init();
# Switch off tracing for higher speed:
pen.tracer(False);
for x in range(-w/2, +w/2):
for y in range (-h/2, +h/2):
draw(pen, number, x, y);
# Temporarily switch on tracing to observe drawing:
if (x % 100 == 0):
pen.tracer(True); pen.tracer(False);
pen.tracer(True);
# Draw a pattern element at point (x, y):
def draw(pen, number, x, y):
a = y * (number / 100.0);
b = x * (number / 100.0);
ez = int(a*a*a + b*b*b);
# Try ez = int(a*a + b*b) and other expressions.
if (ez % 2 == 0):
pen.up(); pen.goto(x, y); pen.down();
pen.circle(1);
# Draw pattern #5
pattern(5);
#
The above program is a framework to design original patterns that are
different form anything else - just by playing with the draw function
above. Change the expression that defines ez, use random numbers for
colors, etc. The opportunities for creative designs are unlimited.
Of course the above program is slow. But it delivers exciting designs
and inspires people. This is what matters, particularly in CS1.
Certainly, one can use more realistic platforms, such as VPython, but
then the complexity will probably kill the enthusiasm.
This is why I am interested in the turtle module and its improvement.
(Thank you again, Vern.)
Atanas
Atanas Radenski
mailto:radenski at chapman.edu <mailto:radenski at chapman.edu>
http://www.chapman.edu/~radenski/ <http://www.chapman.edu/~radenski/>
I find television very educating. Every time somebody turns on the set,
I go into the other room and read a book - Groucho Marx
________________________________
From: edu-sig-bounces at python.org [mailto:edu-sig-bounces at python.org] On
Behalf Of kirby urner
Sent: Tuesday, February 28, 2006 5:10 PM
To: Toby Donaldson
Cc: edu-sig at python.org
Subject: Re: [Edu-sig] Edu-sig Digest, Vol 31, Issue 16
On 2/28/06, Toby Donaldson <tjd at sfu.ca> wrote:
1. The broken interaction between Idle and the turtle
package.
2. Poor documentation. To actually understand certain
function
calls, it was necessary to read the turtle.py source code.
My tentative conclusion, reading the above, and from some personal
experience, is the Tkinter turtle.py, while a fun demo, is mostly a toy
and should not be used for serious teaching, at least on Windows. Too
much adverse experience. Too much frustration. In general, Tk on
Windows has a lot of problems -- I generally forsake IDLE and go to a
command window, for good reason. IPython is an alternative (a good one
-- once you get it working in Windows, which is very doable).
I really don't think *any* kind of turtle graphics is essential to
learning programming, although as I said, I think the approach is very
viable and destined to last. I'm not "anti turtle".
My own special interest is in going back to the very early days of Logo,
when a physical robot was used. I'd rather have hardware robots than
screen based ones, with Python bindings. SONY should seed me a
prototype :-D
Kirby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/edu-sig/attachments/20060228/74d4ddbf/attachment-0001.htm
More information about the Edu-sig
mailing list