mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
67 lines
1.7 KiB
Ruby
67 lines
1.7 KiB
Ruby
|
#
|
|||
|
# checkbutton widget demo (called by 'widget')
|
|||
|
#
|
|||
|
|
|||
|
# toplevel widget <20><>¸<EFBFBD>ߤ<EFBFBD><DFA4><EFBFBD><EFBFBD>к<EFBFBD><D0BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if defined?($check_demo) && $check_demo
|
|||
|
$check_demo.destroy
|
|||
|
$check_demo = nil
|
|||
|
end
|
|||
|
|
|||
|
# demo <20>Ѥ<EFBFBD> toplevel widget <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
$check_demo = TkToplevel.new {|w|
|
|||
|
title("Checkbutton Demonstration")
|
|||
|
iconname("check")
|
|||
|
positionWindow(w)
|
|||
|
}
|
|||
|
|
|||
|
# label <20><><EFBFBD><EFBFBD>
|
|||
|
msg = TkLabel.new($check_demo) {
|
|||
|
font $font
|
|||
|
wraplength '4i'
|
|||
|
justify 'left'
|
|||
|
text "<EFBFBD><EFBFBD><EFBFBD>ˤ<EFBFBD> 3 <20>ĤΥ<C4A4><CEA5><EFBFBD><EFBFBD>å<EFBFBD><C3A5>ܥ<EFBFBD><DCA5><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>å<EFBFBD><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥܥ<C8A5><DCA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4>Ѥ<EFBFBD><D1A4>ꡢTcl <20>ѿ<EFBFBD><D1BF>ˤ<EFBFBD><CBA4>Υܥ<CEA5><DCA5><EFBFBD><EFBFBD>ξ<EFBFBD><CEBE>֤<D6A4><F2BCA8A4>ͤ<EFBFBD><CDA4><EFBFBD><EFBFBD>ꤷ<EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߤ<EFBFBD><DFA4>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD>ͤ<CDA4><F2B8ABA4>ˤϡ<CBA4><CFA1>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD>ȡץܥ<D7A5><DCA5><EFBFBD><EFBFBD><EFBFBD><F2A5AFA5>å<EFBFBD><C3A5><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|||
|
}
|
|||
|
msg.pack('side'=>'top')
|
|||
|
|
|||
|
# <20>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
wipers = TkVariable.new(0)
|
|||
|
brakes = TkVariable.new(0)
|
|||
|
sober = TkVariable.new(0)
|
|||
|
|
|||
|
# frame <20><><EFBFBD><EFBFBD>
|
|||
|
TkFrame.new($check_demo) {|frame|
|
|||
|
TkButton.new(frame) {
|
|||
|
text 'λ<><CEBB>'
|
|||
|
command proc{
|
|||
|
tmppath = $check_demo
|
|||
|
$check_demo = nil
|
|||
|
$showVarsWin[tmppath.path] = nil
|
|||
|
tmppath.destroy
|
|||
|
}
|
|||
|
}.pack('side'=>'left', 'expand'=>'yes')
|
|||
|
|
|||
|
TkButton.new(frame) {
|
|||
|
text '<27><><EFBFBD><EFBFBD><EFBFBD>ɻ<EFBFBD><C9BB><EFBFBD>'
|
|||
|
command proc{showCode 'check'}
|
|||
|
}.pack('side'=>'left', 'expand'=>'yes')
|
|||
|
|
|||
|
|
|||
|
TkButton.new(frame) {
|
|||
|
text '<27>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>'
|
|||
|
command proc{
|
|||
|
showVars($check_demo,
|
|||
|
['wipers', wipers], ['brakes', brakes], ['sober', sober])
|
|||
|
}
|
|||
|
}.pack('side'=>'left', 'expand'=>'yes')
|
|||
|
|
|||
|
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
|
|||
|
|
|||
|
|
|||
|
# checkbutton <20><><EFBFBD><EFBFBD>
|
|||
|
[ TkCheckButton.new($check_demo, 'text'=>'<27>磻<EFBFBD>ѡ<EFBFBD> OK', 'variable'=>wipers),
|
|||
|
TkCheckButton.new($check_demo, 'text'=>'<27>֥졼<D6A5><ECA1BC> OK', 'variable'=>brakes),
|
|||
|
TkCheckButton.new($check_demo, 'text'=>'<27>ɥ饤<C9A5>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>', 'variable'=>sober)
|
|||
|
].each{|w| w.relief('flat'); w.pack('side'=>'top', 'pady'=>2, 'anchor'=>'w')}
|
|||
|
|