Python Shapes1

Create a new Python document (File, New, New File.., Python Script, Create)
Copy this code (left side only) into the document to setup your Turtle(s)
from turtle import TurtleScreen, RawTurtle, TK
root = TK.Tk()
cv1 = TK.Canvas(root, width=500, height=500, bg="#ddffff")
cv1.pack()
s1 = TurtleScreen(cv1)
s1.bgcolor("orange")
p = RawTurtle(s1)
t = RawTurtle(s1)

#Insert turtle moves here

TK.mainloop()
 

#Set width and height of #screen


#Colour of background
#Define turtle in variable p
#Define turtle in variable t




#This must go on the end

Setting up a turtle screen video

Turtle Challenge One
Can you write the code for two of these shapes?
square, triangle, rectangle, pentagon, hexagon, septagon, octagon
You may need some of these codes.
You may need to change p to whatever you defined your turtle variable as.
p.fd(50)
p.rt(90)
p.bk(50)
p.lt(90)
#forward 50
#right 90 degrees
#back 50
#left 90 degrees
 DEBUG  your code if it doesn't work

Turtle Challenge Two
Can you write the code for one of these shapes?

You may need some of these codes to fill a shape in
p.begin_fill()
p.circle(60)
p.end_fill()

p.begin_fill()
for i in range(4):
    p.fd(60)
    p.rt(90)
p.end_fill()

#start a fill
#shape
#end fill

#start a fill
#shape


#end fill

fill a shape with colour video
 DEBUG 
your code if it doesn't work

Turtle Challenge Three
Can you write the code for one of these shapes?

 
 DEBUG  your code if it doesn't work

Turtle Challenge Four
Can you write the code for one of these shapes?

You may need some of these code types
p.circle(100)
p.circle(40,180)
p.pu()
p.pd()


for i in range(4):
    p.circle(200)


diff = 90
for i in range(4):
    g.fd(diff)
    g.lt(50)

    diff = diff + 1
#draw a circle with radius of 100
#draw a circle of radius 40 which only goes through #180 degrees (half circle)
#pu to lift pen up and not draw
#pd to put pen down and draw


#Repeat what is underneath 4 times


#Create a variable called diff and put 90 inside it
#Repeat all the code underneath 4 times
#Forward number in variable diff
#Left 50 degrees
#Increase diff by one

repeat code video
using variable inside repeat code video
 DEBUG 
your code if it doesn't work

Turtle Challenge Five
Can you recreate one or more of these?

 Hex Spiral
 Square Spiral
 Torus
 DEBUG  your code if it doesn't work

Comments