| Previous | Next
Configuring a ButtonTypically, you create a widget and then display it at some later time. What we haven't explicitly talked about yet is what you can do in between. All options do not have to be specified when you create a widget. You can configure a widget further at a later time using the $b = $mw->Button(-text => "Self referencing Button")->pack; $b->configure(-command => [\&send_button, $b]); In this example, we needed to use the actual widget reference in the callback for
To determine the current value of an option, call $state = $button->cget(-state); # Get the current value for -state To change the value associated with an option after the widget has been created, you call $button->configure(-text => "New Text"); # Change the text $text = $button->cget(-text); # Get the current text value To get a list of lists describing every option and value for a widget, call
|