aboutsummaryrefslogtreecommitdiff
path: root/demos/triangles.tcl
diff options
context:
space:
mode:
authorlecoanet2003-03-24 12:24:56 +0000
committerlecoanet2003-03-24 12:24:56 +0000
commit0d406ebf18a0fefdbc7df031d3df106b8d204d64 (patch)
tree9d7a2c1dd70b64c2958ab937db4fa978be1571b3 /demos/triangles.tcl
parent31867b10c11defb596f15ed6567e2e4e1f2bbb93 (diff)
downloadtkzinc-0d406ebf18a0fefdbc7df031d3df106b8d204d64.zip
tkzinc-0d406ebf18a0fefdbc7df031d3df106b8d204d64.tar.gz
tkzinc-0d406ebf18a0fefdbc7df031d3df106b8d204d64.tar.bz2
tkzinc-0d406ebf18a0fefdbc7df031d3df106b8d204d64.tar.xz
Portage depuis perl
Diffstat (limited to 'demos/triangles.tcl')
-rw-r--r--demos/triangles.tcl46
1 files changed, 46 insertions, 0 deletions
diff --git a/demos/triangles.tcl b/demos/triangles.tcl
new file mode 100644
index 0000000..bde074c
--- /dev/null
+++ b/demos/triangles.tcl
@@ -0,0 +1,46 @@
+# these simple samples have been developped by C. Mertz mertz@cena.fr and N. Banoun banoun@cena.fr
+# tcl version by Jean-Paul Imbert imbert@cena.fr
+
+if {![info exists zincDemo]} {
+ error "This script should be run from the zinc-widget demo."
+}
+
+set w .triangles
+catch {destroy $w}
+toplevel $w
+wm title $w "Zinc Triangles Demonstration"
+wm iconname $w Triangles
+
+frame $w.buttons
+pack $w.buttons -side bottom -fill x -pady 2m
+button $w.buttons.dismiss -text Dismiss -command "destroy $w"
+button $w.buttons.code -text "See Code" -command "showCode $w"
+pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+
+
+set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*"
+
+zinc $w.zinc -width 700 -height 300 -font 10x20 -render 1 -borderwidth 3 -relief sunken
+pack $w.zinc
+
+# 6 equilateral triangles around a point
+$w.zinc add text 1 -position {5 10} -text "Triangles item without transparency"
+
+set x0 200
+set y0 150
+set coords [list "$x0 $y0"]
+for {set i 0} {$i<=6} {incr i} {
+ set angle [expr $i * 6.28/6]
+ lappend coords "[expr $x0 + 100 * cos($angle)] [expr $y0 - 100 * sin ($angle)]"
+}
+
+set tr1 [$w.zinc add triangles 1 $coords -fan 1 -colors {white yellow magenta blue cyan green red yellow} -visible 1]
+
+
+$w.zinc add text 1 -position {370 10} -text "Triangles item with transparency"
+
+
+# using the clone method to make a copy and then modify the clone"colors
+set tr2 [$w.zinc clone $tr1]
+$w.zinc translate $tr2 300 0
+$w.zinc itemconfigure $tr2 -colors {white;50 yellow;50 magenta;50 blue;50 cyan;50 green;50 red;50 yellow;50}