#import turtle
import turtle
b=turtle.Pen()
b.speed(50)
for i in range(4):
for i in range(4):
for i in range(4):
for i in range(8):
for i in range(3):
for i in range(6):
b.fd(10)
b.lt(60)
b.lt(120)
b.fd(30)
for i in range(2):
b.lt(90)
b.fd(30)
b.lt(-90)
b.fd(10)
b.lt(90)
b.fd(200)
b.lt(90)
# Python program to draw square
# using Turtle Programming
import turtle
skk = turtle.Turtle()
for i in range(4):
skk.forward(50)
skk.right(90)
turtle.done()
"""
TURTLE COMMANDS
command shortcut makes the turtle """
goto(x, y) setpos(x, y) # go to x, y coordinates
forward(d) fd(d) # go forward d units
back(d) bk(d) # go backward d units
left(a) lt(a) # rotate left a degrees
right(a) rt(a) # rotate right a degrees
setheading(h) seth(h) # set heading to h degrees
write(text) # write text in the screen
import turtle # imports it
whateverYouWantToCallIt = turtle.Turtle() # adds it to the project
#code
whateverYouWantToCallIt.forward(10) # moves whateverYouWantToCallIt forward
whateverYouWantToCallIt.color("purple") # color
whateverYouWantToCallIt.left(90) # turns him 90 degrees
whateverYouWantToCallIt.right(90) # turns him 90 degrees the other direction
turtle.write(arg, move=False, align=’left’, font=(‘Arial’, 8, ‘normal’))
arg Info, which is to be written to the TurtleScreen
align One of the strings “left”, “center” or right”
font A tuple (fontname, fontsize, fonttype)
import turtle
a = turtle.Turtle()
a.color("orange")
a.begin_fill()
for i in range (1,11):
a.forward(36)
a.left(36)
a.end_fill()
a.right(90)
a.forward(30)
a.color("red")
a.write("Decagon")
a.forward(25)
# Turtule Yellow Fill Star - Nanosoft
from turtle import *
color('red', 'yellow')
begin_fill()
while True:
forward(200)
left(170)
if abs(pos()) < 2:
break
end_fill()
done()
# Draw something that i don't care about
import turtle as tu
sc =tu.Screen()
sc.bgcolor("black")
t = tu.Turtle()
t.speed(60)
t.pensize(3)
for i in range(100):
t.circle(5 + 2 * i , 44)
if t.pos()[1] >= t.pos()[0]:
t.pencolor("yellow")
t.dot(12)
elif t.pos()[1] <= t.pos()[0]:
t.pencolor("blue")
t.dot(12)
t.hideturtle()
sc.exitonclick()