File: vscale

package info (click to toggle)
scilab 5.5.1-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 337,804 kB
  • ctags: 69,618
  • sloc: xml: 770,056; ansic: 295,010; java: 187,293; fortran: 155,805; cpp: 66,211; ml: 24,230; sh: 23,700; tcl: 14,792; makefile: 8,315; perl: 1,566; php: 690; cs: 614
file content (47 lines) | stat: -rw-r--r-- 1,663 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# vscale.tcl --
#
# This demonstration script shows an example with a vertical scale.
#
# SCCS: @(#) vscale.tcl 1.4 97/03/02 16:28:34


set w .vscale
catch {destroy $w}
toplevel $w
wm title $w "Vertical Scale Demonstration"
wm iconname $w "vscale"
#positionWindow $w
#set font {Helvetica 14}

label $w.msg  -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."
pack $w.msg -side top -padx .5c

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  -side left -expand 1

frame $w.frame -borderwidth 10
pack $w.frame

scale $w.frame.scale -orient vertical -length 284 -from 0 -to 250 \
	-command "setHeight $w.frame.canvas" -tickinterval 50
canvas $w.frame.canvas -width 50 -height 50 -bd 0 -highlightthickness 0
$w.frame.canvas create polygon 0 0 1 1 2 2 -fill SeaGreen3 -tags poly
$w.frame.canvas create line 0 0 1 1 2 2 0 0 -fill black -tags line
frame $w.frame.right -borderwidth 15
pack $w.frame.scale -side left -anchor ne
pack $w.frame.canvas -side left -anchor nw -fill y
$w.frame.scale set 75

proc setHeight {w height} {
    incr height 21
    set y2 [expr $height - 30]
    if {$y2 < 21} {
	set y2 21
    }
    ScilabEval "if (isdef('handle_demo_scale') & is_handle_valid(handle_demo_scale)) then demredraw($y2),end"
    $w coords poly 15 20 35 20 35 $y2 45 $y2 25 $height 5 $y2 15 $y2 15 20
    $w coords line 15 20 35 20 35 $y2 45 $y2 25 $height 5 $y2 15 $y2 15 20
}