【Perl,PHP】LLバトルロワイヤル13【Ruby,Python】
■ このスレッドは過去ログ倉庫に格納されています
0657631
2010/11/10(水) 18:56:27モジュールMTKは、任意のウィジェットにID属性を指定できます。
以下のコードでは、Small/Largeボタンを押すと入力テキストのサイズが変化します。
require 'modern_tk'
text_data = Struct.new(:output, :input).new(MTK.variable, MTK.variable)
MTK.mainloop(
MTK.root(
:title => 'Ruby/Tk!',
:vpack => [
MTK.label(:id => :LABEL, :textvariable => text_data.output),
MTK.entry(:textvariable => text_data.input, :font => [:serif, 18, [:bold]]),
MTK.frame(
:hpack => [
MTK.button(:text => 'Small', :command => proc { MTK[:LABEL].font.size = 14 }),
MTK.button(:text => 'Large', :command => proc { MTK[:LABEL].font.size = 18 }),
MTK.button(
:text => 'OK',
:command => proc { text_data.output.value = "You typed #{text_data.input.value} !" }
)
]
)
]
)
)
■ このスレッドは過去ログ倉庫に格納されています