I have a perl TK widget which has a -command
callback:
my $widget = $mw->Spinbox( -from => -1000, -to => 1000, -increment => 1, -width => 4, -textvariable => $textvariable, -command => sub { ... });
I would like to call a method on the widget inside the command sub.
How can I get a reference to the widget itself inside the callback in a generic way (not by accessing $widget by its name but something generic)?
I have looked into the @_
arguments that get passed into the sub, but they only contain the value of the widget, and the action (e.g. "up"). I was hoping to be able to access the widget via $self or "this" like in javascript.