metalperl has asked for the wisdom of the Perl Monks concerning the following question:

I am using Perl and Tcl/Tk to build a GUI and I ahve run into a question. When I have a checkbutton and I want that checkbutton, when checked in the GUI, to change the color of a text box from gray to white how do I do this particular action? I have tried, poorly, to use bind on the action of <Button-1> and this doesn't get me there. Any suggetions would be great.

Title edit by tye

Replies are listed 'Best First'.
Re: metalperl
by graff (Chancellor) on Jan 29, 2003 at 03:27 UTC
    When you declare the Checkbutton, you would want to have the handle for the text box to be in scope, so you can refer to that in a sub, to be assigned to the Checkbutton's "-command" attribute -- something like the following:
    $txtbox = $textParent->Text(...)->pack(); ... $cbtnParent->Checkbutton(-variable => \$txtboxColor, -text => 'Set textbox color', -offvalue => 'gray', -onvalue => 'white', -command => sub {$txtbox->configure(-backgrou +nd => $txtboxColor)} )->pack(); # (or whatever geometry mgmt you'r +e using)
Re: metalperl
by metalperl (Initiate) on Jan 28, 2003 at 22:20 UTC
    Sorry for the confusion in the title. I did not relealize that title was/is for the name of the problem. My humblest apologies to the Monks and the rest of the users here. metalperl
Re: change color of text box in Perl/Tk
by Mr. Muskrat (Canon) on Jan 28, 2003 at 22:34 UTC

    Can you show us the code that you have right now?