Today's Agenda
4:30 - 4:45PM: Log on & Ice breakers
4:45 - 5:05PM:
Definitions
Turtle: turtle is a pre-installed Python library that enables users to create pictures and shapes by providing them with a virtual canvas.
Fidget Spinner: A fidget spinner is a toy that consists of a ball bearing in the center of a multi-lobed flat structure made from metal or plastic designed to spin along its axis with pressure.
5:05 - 5:10 PM: Bio Break & Guided Python instruction
5:10 - 5:30PM: Guided Python instruction
5:30 - 5:45PM: Announcement & Survey time!
5:45 - 6:00 PM: Save & Share, Conclusion!
from turtle import *
state = {'turn': 0}
def spinner():
clear()
angle = state['turn']/10
right(angle)
forward(100)
dot(120, 'red')
back(100)
right(120)
forward(100)
dot(120, 'green')
back(100)
right(120)
forward(100)
dot(120, 'blue')
back(100)
right(120)
update()
def animate():
if state['turn']>0:
state['turn']-=1
spinner()
ontimer(animate, 20)
def flick():
state['turn']+=10
setup(420, 420, 370, 0)
hideturtle()
tracer(False)
width(20)
onkey(flick, 'space')
listen()
animate()
done()
If you already finish your code!
Try to change few things!
Like: Colors (Red, Green, Blue), Size, and Physics!
from turtle import *
state = {'turn': 0}
def spinner():
clear()
angle = state['turn']/10
right(angle)
forward(100)
dot(120, 'red')
back(100)
right(120)
forward(100)
dot(120, 'green')
back(100)
right(120)
forward(100)
dot(120, 'blue')
back(100)
right(120)
update()
def animate():
if state['turn']>0:
state['turn']-=1
spinner()
ontimer(animate, 20)
def flick():
state['turn']+=10
setup(420, 420, 370, 0)
hideturtle()
tracer(False)
width(20)
onkey(flick, 'space')
listen()
animate()
done()