|
|
Hi David,
The $cmd you set and whose value you check in your proc is a local
variable. The $cmd you assigned to your entry widget as -textvariable
is a global variable. That's why you're seeing the behavior in
question.
To modify the global variable $cmd in your proc, you need to do ONE of
the following things:
* before your first use of the variable cmd, type "global cmd"; this
tells the interpreter that within your proc, $cmd refers to a global
variable rather than a local one.
OR
* before your first use of the variable cmd, type "variable cmd"; this
tells the interpreter that within your proc, $cmd refers to a
namespace variable rather than a local one. This will only work if
your proc is in the global namespace.
OR
* each time you want to modify the global variable $cmd, use it's
fully-namespace-qualified name: ::cmd (so, [set ::cmd 6], [puts
$::cmd], etc.).
Hope that helps,
Aric
|
|