in reply to TK positioning of elements
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' ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Solved: TK positioning of elements
by wwe (Friar) on May 25, 2010 at 08:09 UTC |