source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/vrippack-0.31/lib/linux/tk8.4/demos/hscale.tcl @ 37

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

Added original make3d

File size: 1.7 KB
Line 
1# hscale.tcl --
2#
3# This demonstration script shows an example with a horizontal scale.
4#
5# RCS: @(#) $Id: hscale.tcl,v 1.3 2001/06/14 10:56:58 dkf Exp $
6
7if {![info exists widgetDemo]} {
8    error "This script should be run from the \"widget\" demo."
9}
10
11set w .hscale
12catch {destroy $w}
13toplevel $w
14wm title $w "Horizontal Scale Demonstration"
15wm iconname $w "hscale"
16positionWindow $w
17
18label $w.msg -font $font -wraplength 3.5i -justify left -text "An arrow and a horizontal scale are displayed below.  If you click or drag mouse button 1 in the scale, you can change the length 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 -side top -fill x
29
30canvas $w.frame.canvas -width 50 -height 50 -bd 0 -highlightthickness 0
31$w.frame.canvas create polygon 0 0 1 1 2 2 -fill DeepSkyBlue3 -tags poly
32$w.frame.canvas create line 0 0 1 1 2 2 0 0 -fill black -tags line
33scale $w.frame.scale -orient horizontal -length 284 -from 0 -to 250 \
34        -command "setWidth $w.frame.canvas" -tickinterval 50
35pack $w.frame.canvas -side top -expand yes -anchor s -fill x  -padx 15
36pack $w.frame.scale -side bottom -expand yes -anchor n
37$w.frame.scale set 75
38
39proc setWidth {w width} {
40    incr width 21
41    set x2 [expr {$width - 30}]
42    if {$x2 < 21} {
43        set x2 21
44    }
45    $w coords poly 20 15 20 35 $x2 35 $x2 45 $width 25 $x2 5 $x2 15 20 15
46    $w coords line 20 15 20 35 $x2 35 $x2 45 $width 25 $x2 5 $x2 15 20 15
47}
Note: See TracBrowser for help on using the repository browser.