Here's some basic code, how do I make it run faster?
import turtle
wn = turtle.Screen()
sasha = turtle.Turtle()
length = 12
for i in range(65):
sasha.forward(length)
sasha.right(120)
length = length + 10
Here's some basic code, how do I make it run faster?
import turtle
wn = turtle.Screen()
sasha = turtle.Turtle()
length = 12
for i in range(65):
sasha.forward(length)
sasha.right(120)
length = length + 10
you can use speed()
function
The more you increase the more you increase the value the more it is slow.
You can use it like this sasha.speed(0
) for example.
Note:
speed(0)
is the most fast coz the pen will not draw.
check here for more info
You can use speed()
to change turtle's speed - like in other answer - but you can also turn off animation
turtle.tracer(False)
and you will have to manually inform turtle when it has to update content on screen
turtle.update()
This way you can get all at once - without delay
import turtle
turtle.tracer(False) # stop animation and don't update content on screen
wn = turtle.Screen()
sasha = turtle.Turtle()
length = 12
for i in range(65):
sasha.forward(length)
sasha.right(120)
length = length + 10
turtle.update() # update content on screen
turtle.done()