Drawing using Turtle

Turtle Graphics is a learning environment for Python programming inspired by Logo which is like a board that lets you command a turtle to draw all over the board using certain commands.

Let us import turtle and see how it works.

screenshot-76.png

The turtle shape is a triangle by default. Let us try changing it to a turtle’s body shape.

screenshot-77.png

Let us try drawing a triangle using Turtle.

screenshot-78.png

  • turtle.forward(x) makes the turtle go horizontally for x pixels.
  • turtle.left(y) makes the turtle turn to a position which is at an angle of y degrees from the initial direction.

Let us now try drawing a cool star.

screenshot-79-e1522696775375.png

 

Please check out more functions using Turtle in the official documentation given in  Turtle documentation.

I just tried modifying the star code a little bit and got a different shape. 

screenshot-80-e1522697016498.png

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: