Last change
on this file was 391, checked in by dmik, 11 years ago |
python: Merge vendor 2.7.6 to trunk.
|
-
Property svn:eol-style
set to
native
|
File size:
807 bytes
|
Line | |
---|
1 | #!/usr/bin/env python
|
---|
2 | """ turtle-example-suite:
|
---|
3 |
|
---|
4 | tdemo_yinyang.py
|
---|
5 |
|
---|
6 | Another drawing suitable as a beginner's
|
---|
7 | programming example.
|
---|
8 |
|
---|
9 | The small circles are drawn by the circle
|
---|
10 | command.
|
---|
11 |
|
---|
12 | """
|
---|
13 |
|
---|
14 | from turtle import *
|
---|
15 |
|
---|
16 | def yin(radius, color1, color2):
|
---|
17 | width(3)
|
---|
18 | color("black")
|
---|
19 | fill(True)
|
---|
20 | circle(radius/2., 180)
|
---|
21 | circle(radius, 180)
|
---|
22 | left(180)
|
---|
23 | circle(-radius/2., 180)
|
---|
24 | color(color1)
|
---|
25 | fill(True)
|
---|
26 | color(color2)
|
---|
27 | left(90)
|
---|
28 | up()
|
---|
29 | forward(radius*0.375)
|
---|
30 | right(90)
|
---|
31 | down()
|
---|
32 | circle(radius*0.125)
|
---|
33 | left(90)
|
---|
34 | fill(False)
|
---|
35 | up()
|
---|
36 | backward(radius*0.375)
|
---|
37 | down()
|
---|
38 | left(90)
|
---|
39 |
|
---|
40 | def main():
|
---|
41 | reset()
|
---|
42 | yin(200, "white", "black")
|
---|
43 | yin(200, "black", "white")
|
---|
44 | ht()
|
---|
45 | return "Done!"
|
---|
46 |
|
---|
47 | if __name__ == '__main__':
|
---|
48 | main()
|
---|
49 | mainloop()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.