Tk::Buttonplus - Enhanced Button widget with a bitmap/image AND a text label
use Tk; use Tk::Buttonplus my $mw = MainWindow->new(); my $downangle_data = <<'downangle_EOP'; /* XPM */ static char *arrow[] = { "14 9 2 1", ". c none", "X c black", "..............", "..............", ".XXXXXXXXXXXX.", "..XXXXXXXXXX..", "...XXXXXXXX...", "....XXXXXX....", ".....XXXX.....", "......XX......", "..............", }; downangle_EOP my $downangle = $mw->Pixmap( -data => $downangle_data); my $text = 'bttn-text'; my $bt1 = $mw->Buttonplus( -text => 'Enable', #-image => $downangle, -bitmap => 'error', -command => \&bttn_pressed_cb1, #-borderwidth => '12', #-relief => 'ridge', #-bg => 'orange', #-fg => 'green', -textvariable => \$text, #-side => 'bottom', #-activeforeground => 'skyblue', )->pack(-padx => 50, -pady => 50); my $bt2 = $mw->Button( -text => 'Disable', -command => [\&bttn_pressed_cb2, $bt1], #-image => $downangle, )->pack; Tk::MainLoop; sub bttn_pressed_cb1 { print "bttn 1 pressed.\n"; } sub bttn_pressed_cb2 { print "bttn 2 pressed.\n"; $_[0]->configure(-state => ($_[0]->cget('-state') eq 'normal' ? 'disabled' : 'normal')); }
A Button widget that can be used as a replacement for the standard Button, if you need to display a bitmap/image AND a text label.
for details on supported methods - see Tk::Button
-side => 'value' allows to specify the side at which the bitmap/image is positioned. Value may be one of top, left, bottom or right.
for details on all other options - see Tk::Button
Michael Krause, KrauseM_AT_gmx_DOT_net
This code may be distributed under the same conditions as Perl.
V0.2 (C) 2004, - 2007
To install Tk::DTree, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tk::DTree
CPAN shell
perl -MCPAN -e shell install Tk::DTree
For more information on module installation, please visit the detailed CPAN module installation guide.