in reply to Perl Tk - Frame packing issue

G'day Audar,

Welcome to the monastery.

When asking questions about Tk, please provide a short working example script that we can run. This allows us to reproduce your problem rather than guessing what all the missing code might be. Furthermore, excluding non-essential elements (such as relief, borderwidth, colours, etc.) removes a lot of noise in the code and helps us get to the heart of the problem. Also, a simple piece of ASCII-art, demonstrating the layout you're trying to achieve, is vastly superior to a textual description of what you want: "a picture paints a thousand words".

I added code to what you posted to get the GUI running. I couldn't reproduce what you described. This is the problem I already mentioned: "guessing what all the missing code might be". I can supply a few suggestions as to where you might be going wrong.

Using '-fill => 'both', -expand => 1' will tend to force elements to the centre: this may be one of your issues. See Tk::pack paying particular attention to the sections: "DESCRIPTION", "THE PACKER ALGORITHM" and 'EXPANSION". Hint: it's often useful to temporarily set different background colours (-bg option) for every widget to see exactly what space they are taking up.

The '-anchor' option is a standard widget option as well as a pack() option. I suspect you want the former: check Tk::options and Tk::pack.

Tk::Frame is not intended to be an interactive widget. From its DESCRIPTION:

"A frame is a simple widget. Its primary purpose is to act as a spacer or container for complex window layouts. The only features of a frame are its background color and an optional 3-D border to make the frame appear raised or sunken."

Tk::Pane is probably what you want for the "Scrolled('Frame' ..." code. From its DESCRIPTION:

"Tk::Pane provides a scrollable frame widget. Once created it can be treated as a frame, except it is scrollable."

While unrelated to your current problem (as far as I can tell), you really should avoid Indirect Object Syntax. Its use is strongly discouraged: see perlobj: Invoking Class Methods.

-- Ken

Replies are listed 'Best First'.
Re^2: Perl Tk - Frame packing issue
by Audar (Novice) on Feb 02, 2014 at 05:07 UTC
    Thank you kcott, I have modified my question to be a working example now. This is a pic of what I'm looking for - --------------------------------------------------------------- |Choose delimiter: | | | | | |Choose Filese Folder | | |------------- ------------- | | || || | | | || || | | Text Area | || || | | | || || | | | |------------- ------------- | | | | | | | | | Clear Mask Exit | | ---------------------------------------------------------------

      --------------------------------------------------------------- |Choose delimiter: | | | | | |Choose Filese Folder | | |------------- ------------- | | || || | | | || || | | Text Area | || || | | | || || | | | |------------- ------------- | | | | | | | | | Clear Mask Exit | | ---------------------------------------------------------------

        Sorry about that everyone, brainfart..
        
        ---------------------------------------------------------------
        |Choose delimiter:           |                                |
        |                            |                                |
        |Choose Filese Folder        |                                |
        |------------- ------------- |                                |
        ||           ||            | |                                |
        ||           ||            | |             Text Area          |
        ||           ||            | |                                |
        ||           ||            | |                                |
        |------------- ------------- |                                |
        |                   	     |                                |
        |                   	     |                                |
        | Clear       Mask      Exit |                                |
        ---------------------------------------------------------------