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