●●●●TCL/TKなら俺に聞け 2●●●●at TECH
●●●●TCL/TKなら俺に聞け 2●●●● - 暇つぶし2ch811:デフォルトの名無しさん
11/11/29 22:33:47.99
ググってみたけどこんな方法しかないような

wm geometry . 500x500
canvas .c -bg white
pack .c -expand 1 -fill both
.c create oval 230 230 270 270 -fill red
set moveto ""
bind . <KeyPress-Up> {set moveto "up"}
bind . <KeyPress-Down> {set moveto "down"}
bind . <KeyPress-Right> {set moveto "right"}
bind . <KeyPress-Left> {set moveto "left"}
bind . <KeyRelease> {set moveto ""}
proc move {} {
global moveto
switch $moveto {
up { .c move 1 0 -3 }
down { .c move 1 0 3 }
right { .c move 1 3 0 }
left { .c move 1 -3 0 }
}
after 10 move
}
after 10 move

方向を一つの変数でまとめてるけど方向別にすれば斜め移動も出来る


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch