2003-07-31 16:52:40 -04:00
require " tkcanvas "
if defined? ( $vscale_demo ) && $vscale_demo
$vscale_demo . destroy
$vscale_demo = nil
end
$vscale_demo = TkToplevel . new { | w |
title ( " Vertical Scale Demonstration " )
iconname ( " vscale " )
}
positionWindow ( $vscale_demo )
msg = TkLabel . new ( $vscale_demo ) {
font $font
wraplength '3.5i'
justify 'left'
# text "<22> <> <EFBFBD> ˤ<EFBFBD> <CBA4> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 1<EFBFBD> ĤȾ<C4A4> ľ<EFBFBD> ʥ<EFBFBD> <CAA5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 뤬ɽ<EBA4AC> <C9BD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƥ<EFBFBD> <C6A4> ޤ<EFBFBD> <DEA4> <EFBFBD> \
#<23> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ǥޥ<C7A5> <DEA5> <EFBFBD> <EFBFBD> ܥ<EFBFBD> <DCA5> <EFBFBD> 1<EFBFBD> <EFBFBD> <F2A5AFA5> å<EFBFBD> <C3A5> <EFBFBD> <EFBFBD> ޤ<EFBFBD> <DEA4> ϥɥ<CFA5> <C9A5> å<EFBFBD> <C3A5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \
#<23> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ĺ<EFBFBD> <C4B9> <EFBFBD> <EFBFBD> <EFBFBD> Ѥ<EFBFBD> <D1A4> 뤳<EFBFBD> Ȥ<EFBFBD> <C8A4> Ǥ<EFBFBD> <C7A4> ޤ<EFBFBD> <DEA4> <EFBFBD> "
text " <EFBFBD> ˤϥС <EFBFBD> <EFBFBD> Ƚķ<EFBFBD> <EFBFBD> Υ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 뤬ɽ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƥ<EFBFBD> <EFBFBD> ޤ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ǥޥ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Υ ܥ<EFBFBD> <EFBFBD> <EFBFBD> 1 <20> <EFBFBD> <F2A5AFA5> å<EFBFBD> <C3A5> <EFBFBD> <EFBFBD> 뤫<EFBFBD> ɥ<EFBFBD> <C9A5> å<EFBFBD> <C3A5> <EFBFBD> <EFBFBD> ƥС <C6A5> <D0A1> ι ⤵<CEB9> <E2A4B5> <EFBFBD> Ѥ<EFBFBD> <D1A4> 뤳<EFBFBD> Ȥ<EFBFBD> <C8A4> Ǥ<EFBFBD> <C7A4> ޤ<EFBFBD> <DEA4> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ä<EFBFBD> <C3A4> <EFBFBD> <EFBFBD> <EFBFBD> λ<EFBFBD> <CEBB> <EFBFBD> ץܥ<D7A5> <DCA5> <EFBFBD> <EFBFBD> <EFBFBD> <F2B2A1A4> Ƥ<EFBFBD> <C6A4> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> "
}
msg . pack ( 'side' = > 'top' , 'padx' = > '.5c' )
TkFrame . new ( $vscale_demo ) { | frame |
TkButton . new ( frame ) {
2004-05-01 12:09:54 -04:00
#text 'λ<> <CEBB> '
text '<27> Ĥ<EFBFBD> <C4A4> <EFBFBD> '
2003-07-31 16:52:40 -04:00
command proc {
tmppath = $vscale_demo
$vscale_demo = nil
tmppath . destroy
}
} . pack ( 'side' = > 'left' , 'expand' = > 'yes' )
TkButton . new ( frame ) {
text '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> ɻ<EFBFBD> <C9BB> <EFBFBD> '
command proc { showCode 'vscale' }
} . pack ( 'side' = > 'left' , 'expand' = > 'yes' )
} . pack ( 'side' = > 'bottom' , 'fill' = > 'x' , 'pady' = > '2m' )
TkFrame . new ( $vscale_demo ) { | frame |
borderwidth 10
canvas = TkCanvas . new ( frame ) { | c |
width 50
height 50
bd 0
highlightthickness 0
TkcPolygon . new ( c , 0 , 0 , 1 , 1 , 2 , 2 ) {
fill 'SeaGreen3'
tags 'poly'
}
TkcLine . new ( c , 0 , 0 , 1 , 1 , 2 , 2 , 0 , 0 ) {
fill 'black'
tags 'line'
}
} . pack ( 'side' = > 'left' , 'anchor' = > 'nw' , 'fill' = > 'y' )
scale = TkScale . new ( frame ) {
orient 'vertical'
length 284
from 0
to 250
command proc { | value | setHeight ( canvas , value ) }
tickinterval 50
} . pack ( 'side' = > 'left' , 'anchor' = > 'ne' )
scale . set 75
} . pack
def setHeight ( w , height )
height = height + 21
y2 = height - 30
if y2 < 21
y2 = 21
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
end