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