[Tutor] Questions about the new turtle module in Python 2.6b2
rdm at rcblue.com
Sat Aug 9 12:12:57 CEST 2008
1. I want the window to open with the right edge 0 pixels from the
right edge of my screen.
However, setup(width=.75, height=.915, startx=-0, starty=0) doesn't
work. I have to do the nearest thing,
setup(width=.75, height=.915, startx=-1, starty=0). A small thing,
but what's wrong with perfection.
2. There's a lot I don't understand in
turtle.setup(width=_CFG[, "width"], height=_CFG[, "height"],
startx=_CFG[, "leftright"], starty=_CFG[, "topbottom"])
What is '_CFG'? And how should anyone know what it is?
What is "leftright"? And how to use it?
What is "topbottom"? And how to use it?
Stamp a copy of the turtle shape onto the canvas at the current
turtle position. Return a stamp_id for that stamp, which can be used
to delete it by calling clearstamp(stamp_id)."
But in your version 1
turtle is hidden by hideturtle()! What are you stamping? It seems the
shape, or rectangle. If so, why does the doc say 'turtle'?
4. For my random_rectangles.py program I've started to try out the
new turtle. (See the current state of random_rectanglesV16_web.py at
<http://py77.python.pastebin.com/d3e842821>.) The only downside I've
found is that the new turtle is much faster that the old. I want to
set the speed so that the outlines of rectangles are drawn slowly
enough that the user (me at present) can both appreciate the colors
and have time to check the names of the colors being printed in the
console window. Using the old turtle, I found that a default delay of
1 ((delay(1)) was just right; with the new turtle, setting a delay of
even 50 affects only the first cycle of rectangles. So I don't use
delay at all. Setting the slowest speed of 1 (speed(1)) is still too
fast. How can I slow down the drawing of the rectangles?
5. I've been unable to figure out how to use onclick()
I'd like to find a way to pause my script by clicking on the screen
-- so I could snag an image of what's showing, and then click again
to restart the drawing of the rectangles. And in addition, being able
to stop the program with a double click on the screen would be very
handy. Could you explain how to do these, if in fact they are possible?
That's all for now.
More information about the Tutor