📄 hscale.tcl
字号:
# hscale.tcl --## This demonstration script shows an example with a horizontal scale.## RCS: @(#) $Id: hscale.tcl,v 1.2 1998/09/14 18:23:28 stanton Exp $if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo."}set w .hscalecatch {destroy $w}toplevel $wwm title $w "Horizontal Scale Demonstration"wm iconname $w "hscale"positionWindow $wlabel $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."pack $w.msg -side top -padx .5cframe $w.buttonspack $w.buttons -side bottom -fill x -pady 2mbutton $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 1frame $w.frame -borderwidth 10pack $w.frame -side top -fill xcanvas $w.frame.canvas -width 50 -height 50 -bd 0 -highlightthickness 0$w.frame.canvas create polygon 0 0 1 1 2 2 -fill DeepSkyBlue3 -tags poly$w.frame.canvas create line 0 0 1 1 2 2 0 0 -fill black -tags linescale $w.frame.scale -orient horizontal -length 284 -from 0 -to 250 \ -command "setWidth $w.frame.canvas" -tickinterval 50pack $w.frame.canvas -side top -expand yes -anchor s -fill x -padx 15pack $w.frame.scale -side bottom -expand yes -anchor n$w.frame.scale set 75proc setWidth {w width} { incr width 21 set x2 [expr $width - 30] if {$x2 < 21} { set x2 21 } $w coords poly 20 15 20 35 $x2 35 $x2 45 $width 25 $x2 5 $x2 15 20 15 $w coords line 20 15 20 35 $x2 35 $x2 45 $width 25 $x2 5 $x2 15 20 15}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -