<OT> tcl/tk question: Radio buttons

Alan Jackson ajackson
Mon May 17 11:57:11 PDT 2004


Are you trying to set the checkbutton variable to a string? It is only
allowed to have 1 of 2 values, either 0/1 (the default) or whatever you
define in the -onvalue/-offvalue tags.

On Sun, 21 Dec 2003 20:12:49 -0500
Joel Hammer <joel at hammershome.com> wrote:

> 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 
> 
> _______________________________________________
> Linux-users mailing list
> Linux-users at smtp.linux-sxs.org
> Unsubscribe/Suspend/Etc -> http://smtp.linux-sxs.org/mailman/listinfo/linux-users


-- 
-----------------------------------------------------------------------
| Alan K. Jackson            | To see a World in a Grain of Sand      |
| alan at ajackson.org          | And a Heaven in a Wild Flower,         |
| www.ajackson.org           | Hold Infinity in the palm of your hand |
| Houston, Texas             | And Eternity in an hour. - Blake       |
-----------------------------------------------------------------------


More information about the Linux-users mailing list