blob: 11d1f47cae25491b302f2a387a816c3558130444 [file] [log] [blame]
Benjamin Peterson90f5ba52010-03-11 22:53:45 +00001#!/usr/bin/env python3
Martin v. Löwis97cf99f2008-06-10 04:44:07 +00002""" turtle-example-suite:
3
4 tdemo_yinyang.py
5
6Another drawing suitable as a beginner's
7programming example.
8
9The small circles are drawn by the circle
10command.
11
12"""
13
Martin v. Löwis60ebb8b2008-09-21 07:32:10 +000014from turtle import *
Martin v. Löwis97cf99f2008-06-10 04:44:07 +000015
16def yin(radius, color1, color2):
17 width(3)
18 color("black", color1)
19 begin_fill()
20 circle(radius/2., 180)
21 circle(radius, 180)
22 left(180)
23 circle(-radius/2., 180)
24 end_fill()
25 left(90)
26 up()
27 forward(radius*0.35)
28 right(90)
29 down()
30 color(color1, color2)
31 begin_fill()
32 circle(radius*0.15)
33 end_fill()
34 left(90)
35 up()
36 backward(radius*0.35)
37 down()
38 left(90)
39
40def main():
41 reset()
42 yin(200, "black", "white")
43 yin(200, "white", "black")
44 ht()
45 return "Done!"
46
47if __name__ == '__main__':
48 main()
49 mainloop()