teromakotero

Python_from_Scratch_04_ratkaisu

May 13th, 2019
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. import turtle
  2. import background
  3. import time
  4.  
  5. pycat = turtle.Turtle()
  6. pycat.hideturtle()
  7. screen = turtle.Screen()
  8. image = ()
  9. image = ["pycat_small_left.png","pycat_2_left_small.png"]
  10. screen.addshape(image[0])
  11. pycat.shape(image[0])
  12. pycat.penup()
  13. pycat.goto(-150,0)
  14. pycat.showturtle()
  15. pycat_2 = turtle.Turtle()
  16. pycat_2.hideturtle()
  17.  
  18. screen.addshape(image[1])
  19. pycat_2.shape(image[1])
  20. pycat_2.penup()
  21. pycat_2.goto(-140,0)
  22. pycat_2.hideturtle()
  23.  
  24. # KIRJOITA TÄMÄN RIVIN ALAPUOLELLE OMA KOODISI
  25. while True:
  26.   pycat_2.showturtle()
  27.   pycat.hideturtle()
  28.   pycat.forward(20)
  29.   time.sleep(0.5)
  30.   pycat.showturtle()
  31.   pycat_2.hideturtle()
  32.   pycat_2.forward(20)
  33.   time.sleep(0.5)
Advertisement
Add Comment
Please, Sign In to add comment