An open API service indexing awesome lists of open source software.

https://github.com/parvathy-vijayan/learn-turtle-for-beginners

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.
https://github.com/parvathy-vijayan/learn-turtle-for-beginners

python python-turtle-graphics turtle turtle-graphics turtle-library

Last synced: about 1 year ago
JSON representation

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.

Awesome Lists containing this project

README

          

# 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.