Skip to content

Turtle is a Python feature like a drawing board, which lets us command a turtle to draw different shapes using certain functions like forward(), right(), left() etc.

Notifications You must be signed in to change notification settings

PARVATHY-VIJAYAN/Learn-Turtle-for-Beginners

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Learn-Turtle-for-Beginners

Here I will introduce a module that allows us to create a data object called a turtle that can be used to draw pictures and different shapes using certain functions like forward(), right(), left() etc.

  • Here are some basic methods:
    • left()
    • right()
    • forward()
  • Attributes:
    • color -default black
    • bgcolor
    • heading
    • position - 0,0
    • pensize(width)

    Now just understand what these methods does: left(90) ---> means our virtual turtle will turn 90 degrees to left from its current position which is considered as 0 degrees. right(90) ---> means our virtual turtle will turn 90 degrees to right from its current position. forward(150)---> means our virtual turtle will move forward 150 pixel


    Now understand the code given below :

    import turtle # allows us to use the turtles library.This line imports the module called turtle, which has all the built in functions for drawing on the screen with the Turtle object. wn = turtle.Screen() # creates a graphics window alex = turtle.Turtle() # create a turtle named alex alex.forward(150) # tell alex to move forward by 150 units alex.left(90) # turn by 90 degrees alex.forward(75) # tell alex to move forward by 75 units


    Turtle starts out facing east.

    Ok guys now run the above code to understand more functions and attributes of turtle library.

About

Turtle is a Python feature like a drawing board, which lets us command a turtle to draw different shapes using certain functions like forward(), right(), left() etc.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages