146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
# File 'lib/tk/fontchooser.rb', line 146
def set_for(target, title="Font")
if target.kind_of? TkFont
configs = {
:font=>target.actual_hash,
:command=>proc{|fnt, *args|
target.configure(TkFont.actual_hash(fnt))
}
}
elsif target.kind_of? Hash
fnt = target[:font] rescue ''
fnt = fnt.actual_hash if fnt.kind_of?(TkFont)
configs = {
:font => fnt,
:command=>proc{|fnt, *args|
target[:font] = TkFont.actual_hash(fnt)
}
}
else
configs = {
:font=>target.cget_tkstring(:font),
:command=>proc{|fnt, *args|
target.font = TkFont.actual_hash_displayof(fnt, target)
}
}
end
configs[:title] = title if title
configure(configs)
target
end
|