2003-07-31 16:52:40 -04:00
|
|
|
|
#
|
|
|
|
|
# two image widgets demo (called by 'widget')
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# toplevel widget <20><>¸<EFBFBD>ߤ<EFBFBD><DFA4><EFBFBD><EFBFBD>к<EFBFBD><D0BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if defined?($image1_demo) && $image1_demo
|
|
|
|
|
$image1_demo.destroy
|
|
|
|
|
$image1_demo = nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# demo <20>Ѥ<EFBFBD> toplevel widget <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
$image1_demo = TkToplevel.new {|w|
|
|
|
|
|
title('Image Demonstration #1')
|
|
|
|
|
iconname("Image1")
|
|
|
|
|
positionWindow(w)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# label <20><><EFBFBD><EFBFBD>
|
|
|
|
|
msg = TkLabel.new($image1_demo) {
|
|
|
|
|
font $font
|
|
|
|
|
wraplength '4i'
|
|
|
|
|
justify 'left'
|
|
|
|
|
text "<EFBFBD><EFBFBD><EFBFBD>Υǥ<EFBFBD><EFBFBD>Ǥ<EFBFBD>2<EFBFBD>ĤΥ<EFBFBD><EFBFBD>٥<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><EFBFBD><EFBFBD><EFBFBD>줾<EFBFBD><EFBFBD>ɽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
}
|
|
|
|
|
msg.pack('side'=>'top')
|
|
|
|
|
|
|
|
|
|
# frame <20><><EFBFBD><EFBFBD>
|
|
|
|
|
TkFrame.new($image1_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 = $image1_demo
|
|
|
|
|
$image1_demo = nil
|
|
|
|
|
tmppath.destroy
|
|
|
|
|
}
|
|
|
|
|
}.pack('side'=>'left', 'expand'=>'yes')
|
|
|
|
|
|
|
|
|
|
TkButton.new(frame) {
|
|
|
|
|
text '<27><><EFBFBD><EFBFBD><EFBFBD>ɻ<EFBFBD><C9BB><EFBFBD>'
|
|
|
|
|
command proc{showCode 'image1'}
|
|
|
|
|
}.pack('side'=>'left', 'expand'=>'yes')
|
|
|
|
|
|
|
|
|
|
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
|
|
|
|
|
|
|
|
|
|
# image <20><><EFBFBD><EFBFBD>
|
|
|
|
|
image1a = \
|
2004-05-01 12:09:54 -04:00
|
|
|
|
TkPhotoImage.new('file'=>[$demo_dir,'..',
|
2003-07-31 16:52:40 -04:00
|
|
|
|
'images','earth.gif'].join(File::Separator))
|
|
|
|
|
image1b = \
|
2004-05-01 12:09:54 -04:00
|
|
|
|
TkPhotoImage.new('file'=>[$demo_dir,'..',
|
2003-07-31 16:52:40 -04:00
|
|
|
|
'images','earthris.gif'].join(File::Separator))
|
|
|
|
|
|
|
|
|
|
# label <20><><EFBFBD><EFBFBD>
|
|
|
|
|
[ TkLabel.new($image1_demo, 'image'=>image1a, 'bd'=>1, 'relief'=>'sunken'),
|
|
|
|
|
TkLabel.new($image1_demo, 'image'=>image1b, 'bd'=>1, 'relief'=>'sunken')
|
|
|
|
|
].each{|w| w.pack('side'=>'top', 'padx'=>'.5m', 'pady'=>'.5m')}
|
|
|
|
|
|