jpayne@68: #!/usr/bin/env python3 jpayne@68: """ turtle-example-suite: jpayne@68: jpayne@68: tdemo_yinyang.py jpayne@68: jpayne@68: Another drawing suitable as a beginner's jpayne@68: programming example. jpayne@68: jpayne@68: The small circles are drawn by the circle jpayne@68: command. jpayne@68: jpayne@68: """ jpayne@68: jpayne@68: from turtle import * jpayne@68: jpayne@68: def yin(radius, color1, color2): jpayne@68: width(3) jpayne@68: color("black", color1) jpayne@68: begin_fill() jpayne@68: circle(radius/2., 180) jpayne@68: circle(radius, 180) jpayne@68: left(180) jpayne@68: circle(-radius/2., 180) jpayne@68: end_fill() jpayne@68: left(90) jpayne@68: up() jpayne@68: forward(radius*0.35) jpayne@68: right(90) jpayne@68: down() jpayne@68: color(color1, color2) jpayne@68: begin_fill() jpayne@68: circle(radius*0.15) jpayne@68: end_fill() jpayne@68: left(90) jpayne@68: up() jpayne@68: backward(radius*0.35) jpayne@68: down() jpayne@68: left(90) jpayne@68: jpayne@68: def main(): jpayne@68: reset() jpayne@68: yin(200, "black", "white") jpayne@68: yin(200, "white", "black") jpayne@68: ht() jpayne@68: return "Done!" jpayne@68: jpayne@68: if __name__ == '__main__': jpayne@68: main() jpayne@68: mainloop()