Adding a additional frames is the right idea!
Pack is the most commonly used frame manager and is a good idea.

I think that the thing that you are missing is that you can make a sub() that is a "gizmo factory". I made a simple re-formulation of your code below to demo this idea which produces the same output on my machine as your 2nd version of code. You can make a bit different thing than your %config and include the text to be displayed in that structure and of course modify the add_entry_window() subroutine. There is another post in this thread that describes a widget that does what you need for a labeled entry window. I would use the most simple widget possible.

But what I'm trying to say is that if you wanted 50 of these sort of lines in the GUI, make maybe an AoA and call one sub in a loop that creates them all!

use Tk; $numberOfDailyLogsToCopy = 5; $numberOfAuditLogsToCopy = 5; my $mainWindow = MainWindow->new( -title => "main window", ); add_entry_gizmo ( $mainWindow, \$numberOfDailyLogsToCopy, "Enter the number of daily log files to copy", ); add_entry_gizmo ( $mainWindow, \$numberOfAuditLogsToCopy, "Enter the number of audit log files to copy", ); MainLoop; sub add_entry_gizmo { my ($window, $text_var_ref, $label, ) = @_; my $frame = $window -> Frame( -borderwidth => 2, ) ->pack(-anchor =>'w'); $frame-> Entry( -textvariable =>$text_var_ref, -width => 2, )-> pack(-side => 'left' ); $frame -> Label( -text => $label, ) -> pack(-side => 'left' ); }

In reply to Re: TK positioning of elements by Marshall
in thread TK positioning of elements by wwe

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.