import turtle screen = turtle.Screen() turtle.shape("turtle") turtle.fillcolor("blue") turtle.pencolor("blue") speed = 10 turn = 10 def f(): turtle.forward(speed) turtle.fillcolor("red") turtle.pencolor("red") def b(): turtle.backward(speed) turtle.fillcolor("blue") turtle.pencolor("blue") def l(): turtle.left(turn) def r(): turtle.right(turn) def c(): turtle.clear() turtle.speed(0) screen.onkey(f, "Up") screen.onkey(b, "Down") screen.onkey(l, "Left") screen.onkey(r, "Right") screen.onkey(c, "c") screen.listen() |
Bronze Announcements >