<OT> tcl/tk question: Radio buttons
Joel Hammer
joel
Mon May 17 11:57:10 PDT 2004
I just want to get this point cleared up before I go off in the wrong
direction.
I have found if I change the global variable (-variable) associated with
a checkbutton, the button stops responding.
I have included a program snippet below, as I think you can't have
attachments on this list.
Basically, when I click a radio button, and run a command like
-command {puts "string"}
all works as expected. However, if I change the radiobutton option -variable
in the command, with something like:
-command {set cb "You ran a program"}
the radio button stops responding. cb is my -variable in this radiobutton.
It makes no difference if I remove the -onvalue and -offvalue options.
Is this a bug or a feature or am I missing something?
Thanks,
Joel
#!/etc/alternatives/wish -f
frame .myframe2
pack .myframe2 -anchor w
# The command in the next line is the problem
checkbutton .myframe2.cb -text "Choice 2" -onvalue True -offvalue False -variable cb -command {set cb "You ran a program"}
# This next line works fine
# checkbutton .myframe2.cb -text "Choice 2" -onvalue True -offvalue False -variable cb -command {puts "You changed me"}
label .myframe2.lcb -textvariable cb
pack .myframe2.cb .myframe2.lcb -side left
More information about the Linux-users
mailing list