timber101

Turtle_Basics_Part_1

Feb 28th, 2022 (edited)
711
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Python turtle basics
  2.  
  3. #  Links used https://docs.python.org/3/library/turtle.html#
  4. #  https://www.w3schools.com/colors/colors_names.asp
  5. #  https://html-color.codes/
  6.  
  7. import turtle # imports the Turtle Library
  8.  
  9. wn = turtle.Screen() # open the drawing window
  10. wn.bgcolor("#95dc85")  # change background colour - NOTE Amrican spelling of colour (color)
  11.  
  12. bob = turtle.Turtle() # creates our turtle called bob
  13.  
  14. for i in range(40):  # loop 4 times
  15.     bob.color("blue")
  16.     bob.pensize(10)
  17.     bob.fd(200) # move bob forward 50 - (forward = fd)
  18.     bob.lt(136)   # turn 90 degress -(right = rt, left = lt)
  19.  
  20. # line below is incorrect, sorry
  21. # wn.clickonclose()  # closes the window
  22.  
  23. #should be
  24. wn.exitonclick()  # closes the window
RAW Paste Data Copied