♪ずんずんずん と来りゃ♪ずざざん ざん と来りゃ♪おいらのサイトは ずざざんざん♪製作、運営 y.repeat mail to:y.tack2010@gmail.com 

すうぃった on Tcl

その1
# ボタンを押した時の動作
proc push_button_A {} {
    global buffer
    set buffer "ボタンAを押しましたね"
    pack forget .b2
}
# ボタンを押した時の動作
proc push_button_B {} {
    global buffer
    set buffer "ボタンBを押しましたね"
}

# ラベルの作成
label .l -textvariable buffer
pack .l
#ボタンの作成
    button .b1 -text "button A" -command "push_button_A"
    button .b2 -text "button B" -command "push_button_B"
    # オプションの追加
    pack .b1
    pack .b2
#    button .b1 -text "A" -command "push_button_A"
#    button .b2 -text "B" -command "push_button_B"
#    # オプションの追加
#    pack .b1  -side left -fill both
#    pack .b2  -side left -fill both

その2
# ボタンを押した時の動作
proc push_button_A {} {
    global buffer
    set buffer "ボタンAを押しましたね"
    pack forget .b1
    pack forget .b2
    pack .next
}
# ボタンを押した時の動作
proc push_button_B {} {
    global buffer
    set buffer "ボタンBを押しましたね"
    pack forget .b1
    pack forget .b2
    pack .next
}
# ボタンを押した時の動作
proc push_button_NEXT {} {
    global buffer
    set buffer "ボタンを押して下さい"
    pack forget .next
    # オプションの追加
    pack .b1
    pack .b2
}

# ラベルの作成
label .l -textvariable buffer
pack .l
#ボタンの作成
    global buffer
    set buffer "ボタンを押して下さい"
    button .b1 -text "button A" -command "push_button_A"
    button .b2 -text "button B" -command "push_button_B"
    button .next -text "NEXT" -command "push_button_NEXT"

    # オプションの追加
    pack .b1
    pack .b2
#    pack .b1  -side left -fill both
#    pack .b2  -side left -fill both

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

管理人/副管理人のみ編集できます