diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2008-06-04 06:29:55 +0000 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2008-06-04 06:29:55 +0000 |
commit | 8718459f0f7f42f9fedf1f7525c52bd7ac16b51b (patch) | |
tree | 99aa2c451de1149763fee3b11906524d87a0ef5e /Demo/turtle/tdemo_peace.py | |
parent | 4ed3ed13c5c82f4b46d633cb7f61d6218d6ed320 (diff) | |
download | cpython-git-8718459f0f7f42f9fedf1f7525c52bd7ac16b51b.tar.gz |
Patch #1513695: New turtle module, with demos.
Diffstat (limited to 'Demo/turtle/tdemo_peace.py')
-rw-r--r-- | Demo/turtle/tdemo_peace.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Demo/turtle/tdemo_peace.py b/Demo/turtle/tdemo_peace.py new file mode 100644 index 0000000000..ea57069028 --- /dev/null +++ b/Demo/turtle/tdemo_peace.py @@ -0,0 +1,65 @@ +#!/usr/bin/python +""" turtle-example-suite: + + tdemo_peace.py + +A very simple drawing suitable as a beginner's +programming example. + +Uses only commands, which are also available in +old turtle.py. + +Intentionally no variables are used except for the +colorloop: +""" + +from turtle import * + +def main(): + peacecolors = ("red3", "orange", "yellow", + "seagreen4", "orchid4", + "royalblue1", "dodgerblue4") + + reset() + s = Screen() + up() + goto(-320,-195) + width(70) + + for pcolor in peacecolors: + color(pcolor) + down() + forward(640) + up() + backward(640) + left(90) + forward(66) + right(90) + + width(25) + color("white") + goto(0,-170) + down() + + circle(170) + left(90) + forward(340) + up() + left(180) + forward(170) + right(45) + down() + forward(170) + up() + backward(170) + left(90) + down() + forward(170) + up() + + goto(0,300) # vanish if hideturtle() is not available ;-) + return "Done!!" + +if __name__ == "__main__": + main() + mainloop() |