How do I make a turtle run faster?

Question:

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
Asked By: apsasha

||

Answers:

you can use speed() function
The more you increase the more you increase the value the more it is slow.

  • “fastest”: 0
  • “fast”: 10
  • “normal”: 6
  • “slow”: 3
  • “slowest”: 1

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

Answered By: DINA TAKLIT

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()

Doc: turtle.tracer(), turtle.update()

Answered By: furas