in reply to Re^2: Multiple frames
in thread Multiple frames
#!/usr/bin/perl -d use Tk; $fmain = MainWindow -> new; $fmain -> title("Frame delete test"); @mycolor = qw(red green blue violet yellow black); for ( 0 .. 5 ) { my $frame = $fmain->Frame(-borderwidth => 10, -relief => 'groove', -b +ackground => $mycolor[$_]) ->pack(-side => 'top'); $lbl = $frame -> Label( -text => "Enter username: " ) ->pack; $ent = $frame -> Entry( -text => $username[$_] ) ->pack; $btn = $frame -> Button(-text => "Delete frame # " . $_, -command => sub { $val = $ent->cget('-text'); rmv_frm($frame,$val); } ) ->pack; } $ex = $fmain -> Button(-text => "Exit",-command => sub { exit } ) -> pack; MainLoop; sub rmv_frm { shift -> destroy; #$val_ref = $ent->cget('-text'); #$val = $$val_ref; $val = shift; print "You entered: $val\n"; # if no frames exist, need to "withdraw" fmain. $fmain -> withdraw if $fmain -> children == 0;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Multiple frames
by delmejo (Initiate) on Aug 28, 2013 at 17:57 UTC | |
|
Re^4: Multiple frames
by delmejo (Initiate) on Aug 31, 2013 at 00:59 UTC | |
by Anonymous Monk on Aug 31, 2013 at 06:50 UTC | |
|
Re^4: Multiple frames
by delmejo (Initiate) on Aug 31, 2013 at 13:39 UTC | |
by Anonymous Monk on Aug 31, 2013 at 14:46 UTC | |
by delmejo (Initiate) on Sep 06, 2013 at 01:57 UTC |