source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/vrippack-0.31/src/vrip/lib/tk/demos/vscale.tcl @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1.6 KB
Line 
1# vscale.tcl --
2#
3# This demonstration script shows an example with a vertical scale.
4#
5# RCS: @(#) $Id: vscale.tcl,v 1.2 1998/09/14 18:23:30 stanton Exp $
6
7if {![info exists widgetDemo]} {
8    error "This script should be run from the \"widget\" demo."
9}
10
11set w .vscale
12catch {destroy $w}
13toplevel $w
14wm title $w "Vertical Scale Demonstration"
15wm iconname $w "vscale"
16positionWindow $w
17
18label $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."
19pack $w.msg -side top -padx .5c
20
21frame $w.buttons
22pack $w.buttons -side bottom -fill x -pady 2m
23button $w.buttons.dismiss -text Dismiss -command "destroy $w"
24button $w.buttons.code -text "See Code" -command "showCode $w"
25pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
26
27frame $w.frame -borderwidth 10
28pack $w.frame
29
30scale $w.frame.scale -orient vertical -length 284 -from 0 -to 250 \
31        -command "setHeight $w.frame.canvas" -tickinterval 50
32canvas $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
35frame $w.frame.right -borderwidth 15
36pack $w.frame.scale -side left -anchor ne
37pack $w.frame.canvas -side left -anchor nw -fill y
38$w.frame.scale set 75
39
40proc setHeight {w height} {
41    incr height 21
42    set y2 [expr $height - 30]
43    if {$y2 < 21} {
44        set y2 21
45    }
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
48}
Note: See TracBrowser for help on using the repository browser.