in reply to Perl Tk geometry problem

I don't really know much about the geometry thing, but have you tried to set a proportion using the pack method options? as in:

$child = $Mother->Button()->pack(-expand=1, -fill='both');
Try this link, it has many things on the Geometry Manager, that I've just started reading about: Here, I really really hope it be of value to you and solve this situation. Best of Luck :).

Update:In the pack method, widgets are given allocation rectangles, specific areas where the widgets can hang around upon resizing, this is achieved automatically for pack, the grid command, on the other hand doesn't have such a rectangle to fill-since it deals with grids- so part of your problem can be that, you have to interfere manually to put each widget in your application in Place every other time you changed to a different screen resolution. This arises because:

  1. you have explicitly used the geometry method.
  2. You haven't told the grid how to resize by giving the proper argument to the option -sticky=>.

This way you have disabled automatic resizing completely, now, try without setting the size yourself, or use the -sticky=> option with grid or the equivalent -fill=> and -expand=> options with pack, that means, use pack instead of grid.

be patient and it shall come your way.


Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.

Replies are listed 'Best First'.
Re^2: Perl Tk geometry problem
by lollysticky (Initiate) on Aug 30, 2009 at 00:34 UTC

    Well.. I use 'grid' as a geometry manager, but how can that help me determine the size and height of the Mainwindow? I use 'grid' to assign widgets (like frames and buttons) inside the mainwindow, Could you provice a code example explaining how to use 'grid' to influence the height and width of the MainWindow ?

    update: i still can't figure out how using pack to organise the widgets inside the mainwindow, would help me restrict the resizing of the mainwindow itsel? The resizing still happens when I replace the 'grid' manager with 'pack'. Do i leave the 'geometry(***x***) out?

      Whenever you use the geometry method explicitly, you are actually disabling automatic resizing which means that chances are there your GUI would not look like what you intended it to be across various platforms, I haven't tried this myself but this is what I know about it. Unless you have strong reason to declare the size yourself using geometry I would rather say let the automatic sizing take place through fidgeting with the sizes of the internal widgets and not the mother widget. Tell me how it is coming along with you . :)


      Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.

        I found the problem :P. Apparently, when you view the GUI on another resolution, every widget resizes appropriately, except for those that have a label/text within it. The font-size appears not to 'shrink' when i view the GUI on a smaller resolution screen, thereby having an over-sized widget which results in a distorted GUI.