repl.it
@ColbyCrihfield/

Arrow Keys

Python (with Turtle)

No description

fork
loading
main.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
import turtle
t = turtle.Turtle()
screen = turtle.Screen()
t.color("red")
t.penup()
t.shape("turtle")

def f():
  t.setheading(90)
  t.fd(4)

def r():
  t.setheading(0)
  t.fd(4)

def l():
  t.setheading(180)
  t.fd(4)

def d():
  t.setheading(-90)
  t.fd(4)

screen.onkey(f, "Up")
screen.onkey(r, "Right")
screen.onkey(l, "Left")
screen.onkey(d, "Down")
screen.listen()

import turtle
f = turtle.Turtle()
screen = turtle.Screen()
f.color("red")
f.penup()
f.shape("turtle")

def f():
  f.setheading(90)
  f.fd(4)

def r():
  f.setheading(0)
  f.fd(4)

def l():
  f.setheading(180)
  f.fd(4)

def d():
  fd.setheading(-90)
  f.fd(4)

f.screen.onkey(f, "w")
f.screen.onkey(r, "d")
f.screen.onkey(l, "a")
f.screen.onkey(d, "s")
f.screen.listen()
result
console
?