Last active
December 16, 2015 12:28
-
-
Save MasWag/5434425 to your computer and use it in GitHub Desktop.
tcl/tkによる簡単な乱数生成スクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc intRand {b e} { | |
return [ expr int (rand() * ($e - $b +1) + $b) ] | |
} | |
proc makeResultWin {} { | |
global mi | |
global ma | |
label .l3 -text 結果 | |
label .l4 -text [ intRand $mi $ma ] | |
button .b2 -text 終了 -command exit | |
pack .l3 | |
pack .l4 | |
pack .b2 | |
} | |
set mi 0 | |
set ma 10 | |
label .l1 -text 下限 | |
entry .e1 -textvariable mi | |
label .l2 -text 上限 | |
entry .e2 -textvariable ma | |
button .b1 -text 計算 -command makeResultWin | |
pack .l1 | |
pack .e1 | |
pack .l2 | |
pack .e2 | |
pack .b1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment