-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsketching.py
More file actions
45 lines (30 loc) · 766 Bytes
/
sketching.py
File metadata and controls
45 lines (30 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from turtle import Turtle, Screen
arrow = Turtle()
screen = Screen()
def move_forward():
arrow.forward(10)
def move_right():
arrow.right(10)
def move_left():
arrow.left(10)
def move_backward():
arrow.backward(10)
def clear():
arrow.clear()
arrow.penup()
arrow.home()
arrow.pendown()
def undo_it():
arrow.undo()
screen.listen()
screen.onkeypress(move_forward, key="w")
screen.onkey(move_right, key="d")
screen.onkey(move_left, key="a")
screen.onkeypress(move_backward, key="s")
screen.onkeypress(move_forward, key="Up")
screen.onkey(move_right, key="Right")
screen.onkey(move_left, key="Left")
screen.onkeypress(move_backward, key="Down")
screen.onkey(clear, key="c")
screen.onkey(undo_it, "z")
screen.exitonclick()