Suppose we have multiple Tk buttons. And in -command of each one,the button needs to know wich one it is. A certain -text featuring a unique number for each button can be set when creating them,and then it can be used again by doing something like my $self = shift; my $ label = $self->cget('-text'); and then one can process $label in the manner needed so that he gets the unique number described above and then proceeding according to that number. Is there another way that one can store information in a button ? How can one get the name of the button from inside the -command subroutine.
In reply to a Tk object who knows who he is ? by spx2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |