in reply to Missing TK Messagebox icons
#!/usr/bin/perl use warnings; use strict; use Tk; # from perldoc messageBox # -icon # Specifies an icon to display. On X11 any of the # builtin Tk bitmaps can specified. On Windows only # error, info, question or warning are supported. my $mw = tkinit; my $bits = pack("b8"x8, "...11...", "..1111..", ".111111.", "11111111", "11111111", ".111111.", "..1111..", "...11...",); $mw->DefineBitmap('indicator' => 8,8, $bits); $mw->Button(-text=>'Press Me', -command => sub{ my $message = localtime; &send_message( $message,'indicator','green') } )->pack; $mw->Button(-text=>'Press Me 1', -command => sub{ my $message = localtime; &send_message( $message,'error','red') } )->pack; MainLoop; sub send_message{ my ($message,$icon, $color) = @_; my $mb = $mw->messageBox( -background => 'lightyellow', -foreground => $color, -icon => $icon, -message => $message, -type => 'OK' ); }
|
|---|