Dick Moores schrieb:
At 03:12 AM 8/9/2008, Dick Moores wrote:
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>.) <http://py77.python.pastebin.com/d3e842821%3E.%29%A0> 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?

I seem to have solved #4.

I had been using tracer() as tracer(True) in my function draw_rect(). In rereading the doc, I noticed that < http://docs.python.org/dev/library/turtle.html#turtle.tracer>
has
"turtle.tracer(/flag=None/, /delay=None/)"

so in draw_rect() I tried changing tracer(True) to tracer(True, dly). (See the new version, random_rectanglesV17_web.py, at < http://py77.python.pastebin.com/f54c9211f>, lines 220, 230, 240, etc.)

Then I enabled the user to enter both speed and delay, with a default speed of 1 and a default delay of 15 (see the new function get_speed_and_delay_from_user(), lines 153-179). On my computer, these defaults seemed to be ideal.

That's fine!
But now I have another puzzle: As long as delay is kept constant, it doesn't seem to matter what speed is chosen -- from the slowest of 1 to the fastest of 0. Why is speed irrelevant?
Did you observe that faster speeds need arguments in the range from 2 to 10?
That means speed(10) is fastest speed.

Gregor

Dick

BTW at < http://py77.python.pastebin.com/f54c9211f>, if you click on the 'view diff' link just above the code, you'll get a diff with the immediately previous version.





------------------------------------------------------------------------

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to