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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# -*- coding: utf-8 -*-
#
# iconic button widget demo (called by 'widget')
#
# toplevel widget ãåå¨ããã°åé¤ãã
if defined?($icon_demo) && $icon_demo
$icon_demo.destroy
$icon_demo = nil
end
# demo ç¨ã® toplevel widget ãçæ
$icon_demo = TkToplevel.new {|w|
title("Iconic Button Demonstration")
iconname("icon")
positionWindow(w)
}
base_frame = TkFrame.new($icon_demo).pack(:fill=>:both, :expand=>true)
# label çæ
msg = TkLabel.new(base_frame) {
font $font
wraplength '5i'
justify 'left'
text "ãã®ã¦ã£ã³ãã¦ã«ã¯ã©ã¸ãªãã¿ã³ã¨ãã§ãã¯ãã¿ã³ä¸ã«ãããããããç»åã表示ãã 3 ã¤ã®æ¹æ³ã示ãã¦ãã¾ããå·¦ã«ããã®ã¯2ã¤ã®ã©ã¸ãªãã¿ã³ã§ãããããããããããããã¨é¸æã示ãã¤ã³ã¸ã±ã¼ã¿ã§ã§ãã¦ãã¾ããä¸å¤®ã«ããã®ã¯ãé¸ææ¸ã¿ãã©ããã«ãã£ã¦ç°ãªãç»åã表示ãããã§ãã¯ãã¿ã³ã§ããå³å´ã«ããã®ã¯é¸ææ¸ã¿ãã©ããã«ãã£ã¦èæ¯è²ãå¤ããããããããã表示ãããã§ãã¯ãã¿ã³ã§ãã"
}
msg.pack('side'=>'top')
# frame çæ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
#text 'äºè§£'
text 'éãã'
command proc{
tmppath = $icon_demo
$icon_demo = nil
tmppath.destroy
}
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
text 'ã³ã¼ãåç
§'
command proc{showCode 'icon'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
# image çæ
flagup = \
TkBitmapImage.new('file'=>[$demo_dir,'..',
'images','flagup.xbm'].join(File::Separator),
'maskfile'=>\
[$demo_dir,'..','images','flagup.xbm'].join(File::Separator))
flagdown = \
TkBitmapImage.new('file'=>[$demo_dir,'..',
'images','flagdown.xbm'].join(File::Separator),
'maskfile'=>\
[$demo_dir,'..',
'images','flagdown.xbm'].join(File::Separator))
# å¤æ°çæ
letters = TkVariable.new
# frame çæ
TkFrame.new(base_frame, 'borderwidth'=>10){|w|
TkFrame.new(w) {|f|
# TkRadioButton.new(f){
Tk::RadioButton.new(f){
bitmap '@' + [$demo_dir,'..',
'images','letters.xbm'].join(File::Separator)
variable letters
value 'full'
}.pack('side'=>'top', 'expand'=>'yes')
# TkRadioButton.new(f){
Tk::RadioButton.new(f){
bitmap '@' + [$demo_dir,'..',
'images','noletter.xbm'].join(File::Separator)
variable letters
value 'empty'
}.pack('side'=>'top', 'expand'=>'yes')
}.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'5m')
# TkCheckButton.new(w) {
Tk::CheckButton.new(w) {
image flagdown
selectimage flagup
indicatoron 0
selectcolor self['background']
}.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'5m')
# TkCheckButton.new(w) {
Tk::CheckButton.new(w) {
bitmap '@' + [$demo_dir,'..',
'images','letters.xbm'].join(File::Separator)
indicatoron 0
selectcolor 'SeaGreen1'
}.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'5m')
}.pack('side'=>'top')
|