Search code examples
pythonturtle-graphicspython-turtle

How to install turtlegraphics in python


I'm trying my hands on Turtle but I can't get the module installed.

I have searched a lot and people seems to imply that it is included in the Python standard library with Tkinter but this doesn't seem to be the case for me.

when I do:

import Tkinter 

everything seems ok. But when I try

t1 = Turtle()

I get the error

NameError: name 'Turtle' is not defined

As per the tutorial I'm suppose to import like this:

from turtlegraphics import Turtle

But no matter what I've tried I cant find how I can get the library installed.


Solution

  • You need to import it from the turtle module.

    from turtle import Turtle
    t1 = Turtle()
    t1.forward(100)