**Better format** ok, so now i have added an entry widget to all the frames and using an array to store the values. it is always empty.
#!/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; }

In reply to Re^4: Multiple frames by delmejo
in thread Multiple frames by delmejo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.