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