Version 2 of size and proportion of widgets

Updated 2003-08-10 10:32:05

Aug 10, 2003

Common problems in the path of Tk beginners:

  • You design the default size and position of your app very carefully. It always starts with the same size. And at the very same spot on your screen. You provide an ideal amount of space between any two individual widgets. The whole set looks perfect. But all is lost in a different screen resolution.
  • You make a text widget in your app. After some time (minutes or days), you maximize the app for the first time. The app is maximized, but the text widget and everything else keep the same size and is now surrounded by a lot of gray empty space.

In HTML, the use of percentage measures is very common and trivial. In Tk, you have to calculate and generate the right sizes and proportions yourself.

That may not be a lot of fun. You'll spend quite some time working with the dreaded expr command, and probably also many levels of nested brackets...


jmn 2003-08-10 As a Tk beginner, I find all my admittedly modest GUI resizing requirements admirably handled by the pack layout manager and the -expand option. Whilst sometimes it's easy to make a mistake and get the dreaded empty grey space attack when resizing - it only takes a little playing about with the pack options to sort it out. I'm not sure exactly what you're trying to achieve with the resizing that can't be simply handled by pack; perhaps you have more stringent requirements than I with respect to exact widget proportions, but it seems to me that the text above is a touch too negative about the situation for Tk beginners.