use strict; use warnings; use Tk; use Tk::Entry; our $mw = new MainWindow; our $main; my $new_label = $mw -> Label(-text=>"Enter any character", -foreground=>"red", -font => "verdanafont 10 bold") -> pack(-side=>"top"); my $ent=$mw->Entry()->pack(); my $press = $mw -> Button(-text=>"Press Me", -command =>\&PressMe, -font => "verdanafont 10 bold") -> pack(-side=>"left",-padx=>"5", -ipadx=>"5"); MainLoop; sub PressMe { my $val = $ent->get(); if ($val =~ m/[a-zA-Z0-9]/) { #my $response=$mw -> messageBox(-type=>"ok", -message=>"al +phanumeric entered",-icon=>"info",-title=> "info!!"); if (!Exists($main)) { $main = $mw->Toplevel; $main->geometry("250x100"); $main->transient($mw); $main->protocol('WM_DELETE_WINDOW' => sub {$main->destroy( +);}); #$main->Photo('-format'=>'jpeg', -file => "\@C:\\warn.jpg" +); #my $l=$main->Label(-image=>'hi')->pack; my $l = $main->Label(-bitmap=>"info")->pack(-side=>"left") +; my $ll=$main->Label(-text=>"Alpha numeric entered !")->pac +k(); } else { $main->deiconify(); $main->raise(); } } return; }
In reply to How to get error/info/warning icons in perl /tk by kapsule
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |