Also you can check out perldoc Tk::Derived. Here is an example:
#!/usr/bin/perl use Tk; use strict; package MyButton; use base qw/Tk::Derived Tk::Button/; Construct Tk::Widget 'MyButton'; sub ClassInit { my ($class, $mw) = @_; $class->SUPER::ClassInit($mw); } sub Populate { my ($self, $args) = @_; $self->SUPER::Populate($args); $self->bind('<Enter>', sub{print "Entered a MyButton\n"}); } 1; package main; my $mw = MainWindow->new; $mw->Button(-text => 'NormalButton')->pack; $mw->MyButton(-text => 'MyButton')->pack; MainLoop;
In reply to Re: Deriving Perl TK
by zentara
in thread Deriving Perl TK
by PerlingTheUK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |