How to change turtle speed in Python
Learn how to change turtle speed in Python. Discover methods, tips, real-world applications, and how to debug common errors.

Python's turtle module makes graphics easy. For smooth animations, you must control the draw speed. The speed() function gives you precise control over the turtle's pace.
In this article, you'll learn several techniques to adjust the turtle's speed. You'll get practical tips, see real-world examples, and find solutions for common speed-related bugs.
Using the speed() method
import turtle
t = turtle.Turtle()
t.speed(1) # Set to slowest speed
t.forward(100)
t.left(90)
t.forward(100)--OUTPUT--Output: Turtle moves very slowly, drawing a right angle with two 100-unit lines.
The speed() method directly controls the turtle's animation pace. By setting t.speed(1), you're choosing the slowest possible drawing speed. This is incredibly useful when you need to debug your code or simply want to watch the drawing unfold step-by-step for clarity. The function accepts an integer from 0 to 10 to define the speed.
- Slowest to Fastest: Values from
1(slowest) to10(fast) offer granular control. - Instantaneous: A value of
0turns off the animation entirely, making the drawing appear instantly.
Basic speed control techniques
While numeric values give you direct control, the speed() method also offers predefined string settings and other tricks for managing your animation's pace.
Using predefined speed settings
import turtle
t = turtle.Turtle()
# Available speeds: 'slowest'(1), 'slow'(3), 'normal'(6), 'fast'(10), 'fastest'(0)
t.speed('fast')
t.circle(50)--OUTPUT--Output: Turtle quickly draws a circle with radius 50 units.
For improved readability, the speed() method also accepts string arguments. These keywords are more intuitive than numbers and make your code easier to understand at a glance. They map directly to the integer values, so you get the same control with added clarity. For example, t.speed('fast') is the same as t.speed(10).
'slowest': 1'slow': 3'normal': 6'fast': 10'fastest': 0
Setting maximum speed with 0
import turtle
t = turtle.Turtle()
t.speed(0) # 0 is the fastest speed
for i in range(4):
t.forward(100)
t.right(90)--OUTPUT--Output: Turtle draws a square almost instantly at maximum speed.
While it seems counterintuitive, setting the speed to 0 gives you the fastest possible drawing time. Using t.speed(0) effectively disables the animation, so the turtle's path isn't rendered step-by-step. Instead, the final image appears on the screen almost instantly.
- This is ideal for complex or repetitive drawings where you only need the final output.
- It saves considerable time when you don't need to visualize the drawing process itself.
Temporarily changing speed for complex operations
import turtle
t = turtle.Turtle()
t.speed(6) # Normal speed for simple lines
t.forward(100)
current_speed = t.speed()
t.speed(1) # Slow down for the detailed turn
t.left(90)
t.speed(current_speed) # Return to original speed--OUTPUT--Output: Turtle moves at normal speed, slows down for the turn, then returns to normal speed.
You can dynamically change the turtle's speed to emphasize certain parts of your drawing. This is useful when you want to move quickly through simple sections but slow down for more complex or detailed movements.
- Store the current speed by calling
t.speed()without an argument and saving it to a variable. - Set a new, slower speed for the detailed part of the drawing.
- Once the complex operation is complete, you can restore the original speed using your saved variable.
Advanced speed control techniques
When the speed() method isn't enough, functions like tracer() and delay() give you finer control over screen updates, timing, and synchronizing multiple turtles.
Using tracer() for ultra-fast drawing
import turtle
screen = turtle.Screen()
screen.tracer(0) # Turn off animation updates
t = turtle.Turtle()
for i in range(36):
t.forward(100)
t.right(170)
screen.update() # Update the screen once drawing is complete--OUTPUT--Output: No animation is shown during drawing. The completed star pattern appears instantly.
For maximum drawing speed, the tracer() method is your best tool. Calling screen.tracer(0) turns off automatic screen updates, so the turtle draws everything in the background without rendering it frame by frame. This makes it significantly faster than even speed(0).
- Once your drawing is complete, you must call
screen.update()to display the final image. - This technique is perfect for complex graphics where you only care about the end result, not the animation process.
Controlling animation delay with delay()
import turtle
screen = turtle.Screen()
t = turtle.Turtle()
t.speed(0) # Set maximum speed
screen.delay(20) # Set animation delay in milliseconds
for i in range(5):
t.forward(100)
t.right(144)--OUTPUT--Output: Turtle draws a star pattern with a slight delay between movements, even at max speed.
The delay() method gives you precise control over animation timing by setting a pause between screen updates. Unlike speed(), you call it on the Screen object, and it defines the delay in milliseconds. This lets you fine-tune the animation's rhythm independently of the turtle's movement speed.
- Even with
t.speed(0), usingscreen.delay(20)forces a 20-millisecond pause after each drawing step. - This creates a smooth, consistently timed animation—perfect for when timing is more important than raw drawing speed.
Synchronizing multiple turtles with different speeds
import turtle
screen = turtle.Screen()
t1 = turtle.Turtle()
t2 = turtle.Turtle()
t1.speed(1) # Slow turtle
t2.speed(10) # Fast turtle
t2.penup()
t2.goto(100, 0)
t2.pendown()
for i in range(4):
t1.forward(50)
t1.left(90)
t2.forward(50)
t2.left(90)--OUTPUT--Output: Two turtles draw squares simultaneously, with the second turtle moving much faster than the first.
You can manage multiple turtles in the same window, each with its own speed setting. In this example, two turtles, t1 and t2, are created. The first turtle is set to a slow speed with t1.speed(1), while the second is much faster at t2.speed(10).
- Each turtle's speed is independent, allowing for complex, layered animations.
- Even when running the same commands in a loop, their different speeds mean they'll draw at visibly different paces, creating a dynamic effect.
Move faster with Replit
Replit is an AI-powered development platform that transforms natural language into working applications. Describe what you want to build, and Replit Agent creates it—complete with databases, APIs, and deployment.
For the speed control techniques we've explored, Replit Agent can turn them into production-ready tools. You could build:
- An interactive art generator that uses
delay()to let users control the animation speed of geometric patterns. - A utility that instantly creates complex fractal designs by leveraging
tracer(0)for maximum rendering speed. - A simple race simulation that visualizes multiple objects moving at different paces, each controlled by its own
speed()setting.
Describe your app idea, and Replit Agent writes the code, tests it, and fixes issues automatically, all in your browser. Try Replit Agent and bring your concepts to life.
Common errors and challenges
Even with the right tools, you might run into a few common snags when adjusting turtle speed.
Fixing errors with invalid speed() values
The speed() method is specific about its inputs. If you provide a value outside the accepted range of integers from 0 to 10 or use a string that isn't one of the predefined keywords, your program will stop and raise a TurtleError. For example, calling t.speed(15) or t.speed('very fast') will fail.
- Always double-check that your speed argument is a valid integer (
0-10) or one of the recognized strings:'slowest','slow','normal','fast', or'fastest'.
Troubleshooting when screen.update() is missing
When you use screen.tracer(0) for maximum speed, you're telling the program not to update the display automatically. A common mistake is forgetting to call screen.update() at the end. Without it, your drawing completes in the background, but nothing ever appears on the screen, leaving you with a blank window.
- Think of
screen.tracer(0)as turning off the lights andscreen.update()as flipping them back on to see the result. Always pair them together.
Optimizing speed when repositioning with penup()
Sometimes your turtle needs to move to a new location without drawing a line. If you just use movement commands like goto(), the turtle will draw an unwanted line across the screen, which also takes time. This can make your animation look messy and feel slow.
The solution is to lift the pen before moving. By using t.penup(), you can reposition the turtle instantly without leaving a trail. Once it's in the right spot, call t.pendown() to start drawing again. This simple trick keeps your graphics clean and your program running efficiently.
Fixing errors with invalid speed() values
You can't just give the speed() method any number you want. It's designed to only accept integers from 0 to 10 or a few specific keywords. If you try an invalid value, Python will raise a TurtleError. The code below demonstrates this.
import turtle
t = turtle.Turtle()
t.speed(15) # Invalid speed value
t.forward(100)
The program halts because t.speed(15) provides an argument outside the accepted 0-10 range, triggering a TurtleError. Execution stops instantly, so the turtle never moves. The corrected code below shows how to fix this.
import turtle
t = turtle.Turtle()
t.speed(10) # Maximum valid speed (0-10)
t.forward(100)
The fix is to simply provide a valid argument. The speed() method strictly requires an integer between 0 and 10. By replacing the invalid value with t.speed(10), the code now uses the fastest valid speed and avoids the TurtleError.
- Keep an eye on this when using variables to set the speed, as their values might accidentally exceed the accepted range during calculations.
Troubleshooting when screen.update() is missing
Using screen.tracer(0) without a final screen.update() call leads to a common issue: a blank screen. The turtle draws in the background, but without the update command, the result is never rendered. See what happens in the code below.
import turtle
screen = turtle.Screen()
screen.tracer(0)
t = turtle.Turtle()
for i in range(36):
t.forward(50)
t.right(10)
The code turns off screen updates with screen.tracer(0) but never tells the window when to display the final drawing. The turtle draws the shape in memory, but the screen remains blank. See the corrected version below.
import turtle
screen = turtle.Screen()
screen.tracer(0)
t = turtle.Turtle()
for i in range(36):
t.forward(50)
t.right(10)
screen.update()
The fix is simple: add screen.update() after your drawing loop. This command manually refreshes the screen, revealing the completed image that the turtle drew in the background. Without it, your work remains hidden.
- Think of
screen.tracer(0)as pausing the display. screen.update()is what you use to show the final result.
This is a common oversight when optimizing for speed, so always remember to pair these two functions.
Optimizing speed when repositioning with penup()
Using penup() is great for moving without drawing, but it doesn't make the turtle move any faster. If your speed is set low, repositioning can still be sluggish and slow down your entire animation. See what happens in the code below.
import turtle
t = turtle.Turtle()
t.speed(1)
t.penup()
t.goto(100, 100) # Moves at the same slow speed
t.pendown()
Even with penup(), the turtle's movement is tied to its current speed setting. Since the speed is set to 1, the goto() command is still sluggish. See how to fix this in the code below.
import turtle
t = turtle.Turtle()
t.speed(1)
t.penup()
t.speed(0) # Temporarily increase speed for positioning
t.goto(100, 100)
t.speed(1) # Return to original speed
t.pendown()
The solution is to temporarily boost the speed just for the move. Before calling t.goto(), set the speed to maximum with t.speed(0) to make the repositioning instant. Once the turtle is in place, you can restore its original speed to continue drawing at the intended pace.
- This technique is essential for complex animations where you need to jump between drawing locations without a slow, distracting transition.
Real-world applications
Mastering speed control isn't just about avoiding errors; it's about building dynamic animations and useful visual tools for real-world projects.
Simulating a race with different speed() values
This concept is perfect for creating a simple race, where you can assign different speed() values to two turtles and watch them compete.
import turtle
t1, t2 = turtle.Turtle(shape="turtle"), turtle.Turtle(shape="turtle")
t1.penup(), t2.penup()
t1.goto(-200, 30), t2.goto(-200, -30)
t1.speed(3), t2.speed(7) # Different racing speeds
t1.pendown(), t2.pendown()
t1.forward(400), t2.forward(400) # Race to the finish line
This code shows how you can control multiple turtles independently. Two turtle objects, t1 and t2, are created and moved to separate starting lines using penup() and goto(). The key is setting different animation speeds for each one with t1.speed(3) and t2.speed(7).
t1is set to a slower speed, making its movement more deliberate.t2is set to a faster speed, so it moves much more quickly.
When both are commanded to move forward(400), t2 finishes its path well before t1, demonstrating how individual speed settings create dynamic, asynchronous animations.
Creating a loading animation with dynamic speed() changes
You can also create practical animations, like a loading bar that speeds up as it progresses, by changing the speed() value within a loop.
import turtle
t = turtle.Turtle()
t.penup(), t.goto(-150, 0), t.pendown()
# Draw loading bar with increasing speed
for i in range(10):
t.speed(i + 1) # Speed increases with each segment
t.forward(30)
t.write(f"{(i+1)*10}%")
This code creates a loading bar that visually accelerates by dynamically adjusting the turtle's speed inside a for loop. As the loop progresses, each new segment of the bar is drawn faster than the last, creating a sense of momentum as the animation nears completion.
- The loop iterates ten times, with
t.speed(i + 1)increasing the speed from1up to10on each pass. - After drawing each 30-unit segment with
t.forward(30), thet.write()function labels the current progress with a percentage.
Get started with Replit
Now, turn these speed control concepts into a real application. Just tell Replit Agent what you want, like “build a sorting algorithm visualizer” or “create an interactive art tool with a speed slider.”
Replit Agent will write the code, test for bugs, and deploy your app. Start building with Replit to turn your ideas into software instantly.
Create and deploy websites, automations, internal tools, data pipelines and more in any programming language without setup, downloads or extra tools. All in a single cloud workspace with AI built in.
Create & deploy websites, automations, internal tools, data pipelines and more in any programming language without setup, downloads or extra tools. All in a single cloud workspace with AI built in.


.png)
.png)