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