I am trying to make an object start at the top of the screen and go all the way to the bottom and off the screen, then repeat. My teacher wants us to use a while loop so how would I go about this?
If you assume t
is a turtle, help(t)
gives you:
...
...
| hideturtle(self)
| Makes the turtle invisible.
|
| Aliases: hideturtle | ht
|
| No argument.
|
| It's a good idea to do this while you're in the
| middle of a complicated drawing, because hiding
| the turtle speeds up the drawing observably.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.hideturtle()
|
| ht = hideturtle(self)
| Makes the turtle invisible.
|
| Aliases: hideturtle | ht
|
| No argument.
|
| It's a good idea to do this while you're in the
| middle of a complicated drawing, because hiding
| the turtle speeds up the drawing observably.
|
| Example (for a Turtle instance named turtle):
| >>> turtle.hideturtle()
...
...
Similarly, there is a showturtle()
method.
If you do the math:
import turtle
import time
t = turtle.Turtle()
win = turtle.Screen()
for i in range(100):
t.fd(100)
t.hideturtle()
time.sleep(1)
t.showturtle()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.