diff options
author | lecoanet | 2004-05-07 15:31:01 +0000 |
---|---|---|
committer | lecoanet | 2004-05-07 15:31:01 +0000 |
commit | 9f0d489e9cda59a8ed026be96fa56f9ecc1a33f7 (patch) | |
tree | 842972357fdc905c7353dacf88a10e78427b96d8 /demos/colorX.tcl | |
parent | 752ff8735f731e8d37fb1bea60b0323af1a1ec06 (diff) | |
download | tkzinc-9f0d489e9cda59a8ed026be96fa56f9ecc1a33f7.zip tkzinc-9f0d489e9cda59a8ed026be96fa56f9ecc1a33f7.tar.gz tkzinc-9f0d489e9cda59a8ed026be96fa56f9ecc1a33f7.tar.bz2 tkzinc-9f0d489e9cda59a8ed026be96fa56f9ecc1a33f7.tar.xz |
Switched from pack to grid; Demos are put in a namespace; No more name aliases for fonts
Diffstat (limited to 'demos/colorX.tcl')
-rw-r--r-- | demos/colorX.tcl | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/demos/colorX.tcl b/demos/colorX.tcl index c93ba35..2a4d8a3 100644 --- a/demos/colorX.tcl +++ b/demos/colorX.tcl @@ -5,38 +5,44 @@ if {![info exists zincDemo]} { error "This script should be run from the zinc-widget demo." } -set w .colorX -catch {destroy $w} -toplevel $w -wm title $w "Zinc Color-x Demonstration" -wm iconname $w "Color X" +namespace eval colorX { + variable w .colorX + catch {destroy $w} + toplevel $w + wm title $w "Zinc Color-x Demonstration" + wm iconname $w "Color X" -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 + grid [button $w.dismiss -text Dismiss -command "destroy $w"] -row 2 -column 0 -pady 10 + grid [button $w.code -text "See Code" -command "showCode $w"] -row 2 -column 1 -pady 10 -set defaultfont [font create -family Helvetica -size 10 -weight bold] + variable defaultfont [font create -family Helvetica -size 14 -weight normal] -zinc $w.zinc -width 700 -height 600 -borderwidth 3 -relief sunken -render 1 -pack $w.zinc + grid [zinc $w.zinc -width 700 -height 600 -borderwidth 3 -relief sunken -render 1] \ + -row 1 -column 0 -columnspan 2 -sticky news + grid columnconfigure $w 0 -weight 1 + grid columnconfigure $w 1 -weight 1 + grid rowconfigure $w 1 -weight 2 + + $w.zinc add rectangle 1 {10 10 690 100} -fillcolor {red|blue} -filled 1 -$w.zinc add rectangle 1 {10 10 690 100} -fillcolor {red|blue} -filled 1 + $w.zinc add text 1 -font $defaultfont -anchor nw -position {20 20} \ + -text "A variation from non transparent red to non transparent blue.\n" -$w.zinc add text 1 -font $defaultfont -text "A variation from non transparent red to non transparent blue.\n" -anchor nw -position {20 20} + $w.zinc add rectangle 1 {10 110 690 200} -fillcolor {red;40|blue;40} -filled 1 -$w.zinc add rectangle 1 {10 110 690 200} -fillcolor {red;40|blue;40} -filled 1 + $w.zinc add text 1 -font $defaultfont -anchor nw -position {20 120} \ + -text "A variation from 40%transparent red to 40% transparent blue." -$w.zinc add text 1 -font $defaultfont -text "A variation from 40%transparent red to 40% transparent blue." -anchor nw -position {20 120} + $w.zinc add rectangle 1 {10 210 690 300} -fillcolor {red;40|green;40 50|blue;40} -filled 1 -$w.zinc add rectangle 1 {10 210 690 300} -fillcolor {red;40|green;40 50|blue;40} -filled 1 + $w.zinc add text 1 -font $defaultfont -anchor nw -position {20 220} \ + -text "A variation from 40%transparent red to 40% transparent blue.\nthrough a 40%green on the middle" -$w.zinc add text 1 -font $defaultfont -text "A variation from 40%transparent red to 40% transparent blue.\nthrough a 40%green on the middle" -anchor nw -position {20 220} + $w.zinc add text 1 -font $defaultfont -anchor nw -position {20 320} \ + -text "Two overlaping transparently colored rectangles on a white background" -$w.zinc add text 1 -font $defaultfont -text "Two overlaping transparently colored rectangles on a white background" -anchor nw -position {20 320} + $w.zinc add rectangle 1 {10 340 690 590} -fillcolor white -filled 1 + $w.zinc add rectangle 1 {200 350 500 580} -fillcolor {red;40|green;40 50|blue;40} -filled 1 -$w.zinc add rectangle 1 {10 340 690 590} -fillcolor white -filled 1 -$w.zinc add rectangle 1 {200 350 500 580} -fillcolor {red;40|green;40 50|blue;40} -filled 1 - -$w.zinc add rectangle 1 {10 400 690 500} -fillcolor {yellow;40|black;40 50|cyan;40} -filled 1 + $w.zinc add rectangle 1 {10 400 690 500} -fillcolor {yellow;40|black;40 50|cyan;40} -filled 1 +} |