Fun with Python Turtle Graphics Module - Share Your Turtle Art

Hey Guys,

Python Turtle could be a super fun way of teaching programming to kids. Since I am spending a lot of time with my kid, I am trying to teach him coding by the way of Turtle - Library of Python. My kid is 8 years old. He kind of likes it but still it requires a lot of work to excite him to try it. Let me jump into it.

To learn about it, see: https://docs.python.org/3/library/turtle.html

First step is to import turtle

from turtle import *

Second step is to initialize, screen:

Screen()

To move forward and draw 30 pixels:

forward(30)

To turn left by 120:

left(120)

To back home where you started:
home()

To clear everything:
clear()

You can use it inside loops:

for i in range(3):
    forward(30)
    left(120)

This will draw a triangle:

image

Try drawing fun things such as a cube. And post your code here along with the image. I will be sharing my turtle-art here.

3 Likes

image

for i in range(30):
     circle(5+i*5)
     left(90)
     forward(10)
     right(90)
2 Likes

for i in range(50):
     circle(100, 360)
     left(5)
1 Like

for i in range(100):
     forward(10+i*5)
     left(120)
1 Like

image

for i in range(100):
     forward(10+(i/6)*5)
     left(60)

home();clear()
for i in range(200):
     circle(100, 60-i)
     left(i)

I really liked this one. This is not what I had planned. Serendipity is just amazing!

2 Likes

image

home();clear()
for i in range(50):
     circle(180, 100)
     left(90)

image

>>> home();clear()
>>> for i in range(30):
...     circle(100, 200)
...     left(99)
...

home();clear()
for i in range(600):
    if i % 5 == 0:
        left(3)
    forward(200)
    left(360/5)

image

from tutle import *
Screen()
home();clear()
for i in range(100):
     forward(100)
     left(180)
     forward(100)
     left(180)
     left(i*3.6)
     
left(90)
forward(200)

Hey @sgiri

Hope you’re doing good

Thanks for sharing this particular library i was unaware of this as i am a complete newbie to Python and only know the basics currently am doing the data science specialization and am learning Pig and PigLatin at the moment so it’s a long way to go,

I was playing around the turtle library and i thought of replicating something like the Sun.

Regards,
Surjiv Krishna

SUN%20PYTHON

from turtle import *
color(‘orange’, ‘yellow’)
begin_fill()
while True:
forward(350)
left(170)
right(280)
if abs(pos()) < 1:
break
end_fill()
done()

1 Like

Awesome Surjiv!! The sun looks very beautiful. Keep it going.

1 Like

for i in range(100):
left(5+i*20)
forward(50)

image

>>> for i in range(100):
...     left(30)
...     forward(4+i)
...