Ask coding questions

← Back to all posts
I dont know how to spawn the turtle in
JalielAndrews (0)

I'm using the command from turtle import and it's not coming out also with the command forward (50) , What am i missing?

Commentshotnewtop
RyanRana (168)

This is the code you want:

from turtle import *
a = Turtle()
a.forward(50)
done()

Let's break down this code:

  1. Well obviously, you need to import the turtle. When you use * that means your importing everything.
  2. Turtle() is the actual arrow thing that moves on the screen it is not the screen, it comes up automatically. If you want to add special attributes to the screen you can do s = Screen() and then the attributes. For now, this is just the turtle that will move.
  3. This line moves it 50 px straight. We indicate the turtle we are moving which is a then putting the command.
  4. Then we end the line, you don't need this line but when you x out of the turtle screen an error will appear in the shell. Also, it is kind of a standard for python developers.

Happy Coding!