Version 0 of Yin-yang

Updated 2007-06-12 12:12:48 by jdc

Richard Suchenwirth 2007-06-12 - 'A figure used in many Asian cultures to symbolize the unity of the two "opposite" male and female elements, the "yin" and "yang."' [L1 ] Here's a solution on a canvas with 4 arc items:

 package require Tk

 proc yinyang {w x0 y0 diameter {col1 black} {col2 white}} {
     set xm [expr {$x0 + $diameter/2.}]
     set ym [expr {$y0 + $diameter/2.}]
     set x1 [expr {$x0 + $diameter}]
     set y1 [expr {$y0 + $diameter}]
     set y2 [expr {$ym - $diameter/4.}]
     set y3 [expr {$ym + $diameter/4.}]
     $w create arc $x0 $y0 $x1 $y1 -start 0   -extent 180 -fill $col1
     $w create arc $x0 $y0 $x1 $y1 -start 180 -extent 180 -fill $col2
     $w create arc $x0 $y2 $xm $y3 -start 0   -extent 180 -fill $col2 -outline $col2
     $w create arc $xm $y2 $x1 $y3 -start 180 -extent 180 -fill $col1 -outline $col1
 }

#-- Test and demo:

 pack [canvas .c]
 yinyang .c 20 20 100 red blue

http://tclerswiki.googlepages.com/yinyang.jpg


Category Graphics