Add a script to clean up after Tcl/Tk installation
[git/jnareb-git.git] / mingw / lib / tk8.5 / demos / vscale.tcl
blob599329c00ceacba4a44def8bf534a0dfaff5d7a3
1 # vscale.tcl --
3 # This demonstration script shows an example with a vertical scale.
5 # RCS: @(#) $Id: vscale.tcl,v 1.5 2004/12/21 11:56:35 dkf Exp $
7 if {![info exists widgetDemo]} {
8 error "This script should be run from the \"widget\" demo."
11 package require Tk
13 set w .vscale
14 catch {destroy $w}
15 toplevel $w
16 wm title $w "Vertical Scale Demonstration"
17 wm iconname $w "vscale"
18 positionWindow $w
20 label $w.msg -font $font -wraplength 3.5i -justify left -text "An arrow and a vertical scale are displayed below. If you click or drag mouse button 1 in the scale, you can change the size of the arrow."
21 pack $w.msg -side top -padx .5c
23 ## See Code / Dismiss buttons
24 set btns [addSeeDismiss $w.buttons $w]
25 pack $btns -side bottom -fill x
27 frame $w.frame -borderwidth 10
28 pack $w.frame
30 scale $w.frame.scale -orient vertical -length 284 -from 0 -to 250 \
31 -command "setHeight $w.frame.canvas" -tickinterval 50
32 canvas $w.frame.canvas -width 50 -height 50 -bd 0 -highlightthickness 0
33 $w.frame.canvas create polygon 0 0 1 1 2 2 -fill SeaGreen3 -tags poly
34 $w.frame.canvas create line 0 0 1 1 2 2 0 0 -fill black -tags line
35 frame $w.frame.right -borderwidth 15
36 pack $w.frame.scale -side left -anchor ne
37 pack $w.frame.canvas -side left -anchor nw -fill y
38 $w.frame.scale set 75
40 proc setHeight {w height} {
41 incr height 21
42 set y2 [expr {$height - 30}]
43 if {$y2 < 21} {
44 set y2 21
46 $w coords poly 15 20 35 20 35 $y2 45 $y2 25 $height 5 $y2 15 $y2 15 20
47 $w coords line 15 20 35 20 35 $y2 45 $y2 25 $height 5 $y2 15 $y2 15 20