peace.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/env python3
  2. """ turtle-example-suite:
  3. tdemo_peace.py
  4. A simple drawing suitable as a beginner's
  5. programming example. Aside from the
  6. peacecolors assignment and the for loop,
  7. it only uses turtle commands.
  8. """
  9. from turtle import *
  10. def main():
  11. peacecolors = ("red3", "orange", "yellow",
  12. "seagreen4", "orchid4",
  13. "royalblue1", "dodgerblue4")
  14. reset()
  15. Screen()
  16. up()
  17. goto(-320,-195)
  18. width(70)
  19. for pcolor in peacecolors:
  20. color(pcolor)
  21. down()
  22. forward(640)
  23. up()
  24. backward(640)
  25. left(90)
  26. forward(66)
  27. right(90)
  28. width(25)
  29. color("white")
  30. goto(0,-170)
  31. down()
  32. circle(170)
  33. left(90)
  34. forward(340)
  35. up()
  36. left(180)
  37. forward(170)
  38. right(45)
  39. down()
  40. forward(170)
  41. up()
  42. backward(170)
  43. left(90)
  44. down()
  45. forward(170)
  46. up()
  47. goto(0,300) # vanish if hideturtle() is not available ;-)
  48. return "Done!"
  49. if __name__ == "__main__":
  50. main()
  51. mainloop()