Advertisement
JkSoftware

Day 19 - Etch a Sketch

Dec 2nd, 2021
993
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from turtle import Turtle, Screen
  2.  
  3. timmy = Turtle()
  4. screen = Screen()
  5.  
  6.  
  7. def move_forwards():
  8.     timmy.forward(10)
  9.  
  10.  
  11. def turn_left():
  12.     timmy.left(10)
  13.     timmy.forward(3)
  14.  
  15.  
  16. def turn_right():
  17.     timmy.right(10)
  18.     timmy.forward(3)
  19.  
  20.  
  21. def move_backwards():
  22.     timmy.back(10)
  23.  
  24.  
  25. screen.listen()
  26. screen.onkey(move_forwards, "w")
  27. screen.onkey(turn_right, "d")
  28. screen.onkey(move_backwards, "s")
  29. screen.onkey(turn_left, "a")
  30.  
  31. screen.exitonclick()
  32.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement