Mailing List Archive

Anyone else find Tk akward?
Is it just me, or is the way Tk organizes things on the window someone
weird? I'm just starting to play around with it, and it has me puzzled.
Wouldnt it be a lot easier to just use a coordinte system?
For example put a button at (0,0) with length 10 and width 20 etc..
Are there any reasons why it _has_ to be this way?

--
Orlando Vazquez
Anyone else find Tk akward? [ In reply to ]
Orlando Vazquez writes:

> Is it just me, or is the way Tk organizes things on the window
> someone weird? I'm just starting to play around with it, and it has
> me puzzled. Wouldnt it be a lot easier to just use a coordinte
> system? For example put a button at (0,0) with length 10 and width
> 20 etc.. Are there any reasons why it _has_ to be this way?

Tk windows are designed to be easily resizable. Once you get used to
it (which doesn't take long) you'll have a hard time with GUIs which
expect fixed sizes.

- Gordon
Anyone else find Tk akward? [ In reply to ]
On Thu, 12 Aug 1999 15:42:03 -0700, Orlando Vazquez
<ovazquez@sprint.ca> wrote:
>Is it just me, or is the way Tk organizes things on the window someone
>weird? I'm just starting to play around with it, and it has me puzzled.
>Wouldnt it be a lot easier to just use a coordinte system?
>For example put a button at (0,0) with length 10 and width 20 etc..
>Are there any reasons why it _has_ to be this way?

*What* coordinate system?

What units are you using?

The Tk model of packing "objects" onto a "canvas" allows it to
self-optimize, and lets the programmer not need to worry so much about
those sorts of fiddly details.
--
"The wrath of Holloway is nothing compared to the wrath of Moon."
-- Fred Drenckhahn
cbbrowne@hex.net- <http://www.hex.net/~cbbrowne/lsf.html>
Anyone else find Tk akward? [ In reply to ]
From: cbbrowne@news.hex.net (Christopher Browne)
Subject: Re: Anyone else find Tk akward?
Organization: Giganews.Com - Premium News Outsourcing

On Thu, 12 Aug 1999 15:42:03 -0700, Orlando Vazquez
<ovazquez@sprint.ca> wrote:
>Is it just me, or is the way Tk organizes things on the window someone
>weird? I'm just starting to play around with it, and it has me puzzled.
>Wouldnt it be a lot easier to just use a coordinte system?
>For example put a button at (0,0) with length 10 and width 20 etc..
>Are there any reasons why it _has_ to be this way?

*What* coordinate system?

What units are you using?

The Tk model of packing "objects" onto a "canvas" allows it to
self-optimize, and lets the programmer not need to worry so much about
those sorts of fiddly details.
--
"The wrath of Holloway is nothing compared to the wrath of Moon."
-- Fred Drenckhahn
cbbrowne@hex.net- <http://www.hex.net/~cbbrowne/lsf.html>
--
|Fidonet: UUCP 2:500/3.1
|Internet: UUCP@p1.f3.n500.z2.hccfido.hcc.nl
|
| Standard disclaimer: The views of this user are strictly his own.
Anyone else find Tk akward? [ In reply to ]
Orlando Vazquez wrote:
>
> Is it just me, or is the way Tk organizes things on the window someone
> weird? I'm just starting to play around with it, and it has me puzzled.
> Wouldnt it be a lot easier to just use a coordinte system?
> For example put a button at (0,0) with length 10 and width 20 etc..
> Are there any reasons why it _has_ to be this way?
>

When designing a GUI (on something like VB which at least when I was
using it had absolute positions/sizes) I find that 99% of the time is
getting the positions pixel perfect. Once you have done this you then
either need to stop the user resizing it which is not nice, or you have
to do some VB hackery to get it behaving correctly when resizing and it
never works how you expect it to.

Using geometry managers makes life so much easier because they handle
all of the resizing calculations, the difficult part is learning how
to tell the geometry managers what you want to do.

If you absolutely have to have total control Tk (not sure about Tkinter)
has a place manager which lets you put the windows wherever you want to.

--
Paul Duffin
DT/6000 Development Email: pduffin@hursley.ibm.com
IBM UK Laboratories Ltd., Hursley Park nr. Winchester
Internal: 7-246880 International: +44 1962-816880
Anyone else find Tk akward? [ In reply to ]
Orlando Vazquez <ovazquez@sprint.ca> wrote:
> Is it just me, or is the way Tk organizes things on the window someone
> weird? I'm just starting to play around with it, and it has me puzzled.
> Wouldnt it be a lot easier to just use a coordinte system?
> For example put a button at (0,0) with length 10 and width 20 etc..

http://www.pythonware.com/library/tkinter/introduction/place.htm

> Are there any reasons why it _has_ to be this way?

yes. try using place for a while, and you'll realize
why.

</F>
Anyone else find Tk akward? [ In reply to ]
On Thu, 12 Aug 1999 15:42:03 -0700, Orlando Vazquez <ovazquez@sprint.ca> wrote:
>Is it just me, or is the way Tk organizes things on the window someone
>weird? I'm just starting to play around with it, and it has me puzzled.
>Wouldnt it be a lot easier to just use a coordinte system?
>For example put a button at (0,0) with length 10 and width 20 etc..
>Are there any reasons why it _has_ to be this way?

There are several geometry managers for Tk. There's place, pack, and grid.
I liked grid because it gave me direct control over subwidget placement.
Since you can nest frames with different geometry managers, for example,
a grid frame with pack frames inside of it, you've got the best of both
worlds.

Dave
--
--------------------------------------------------------------------------------
Email: dek@cgl.ucsf.edu David Konerding WWW: http://picasso.ucsf.edu/~dek
--------------------------------------------------------------------------------
Snail: Graduate Group in Biophysics
Medical Sciences 926, Box 0446
University of California
San Francisco, CA 94143
Anyone else find Tk akward? [ In reply to ]
Christopher Browne wrote:
>
> The Tk model of packing "objects" onto a "canvas" allows it to
> self-optimize, and lets the programmer not need to worry so much about
> those sorts of fiddly details.

This is good, except that if you just pack things
together in the simplest and most obvious way, the
results are awful -- everything is jammed together,
and nothing resizes the way you want. To get a layout
which looks good and works properly, you need to deal
with another set of fiddly details, namely the various
padding, filling and expanding options, which (for
me, anyway) seem to work in very unintuitive ways.

The idea of an automatic layout manager is as good
one, but I don't think that any of Tk's geometry
managers are a good implementation of it. I'm not
surprised that some people find them frustrating.

Greg
Anyone else find Tk akward? [ In reply to ]
In article <37B87BAC.CE092017@compaq.com>
greg.ewing@compaq.com "Greg Ewing" writes:
> Christopher Browne wrote:
> >
> > The Tk model of packing "objects" onto a "canvas" allows it to
> > self-optimize, and lets the programmer not need to worry so much about
> > those sorts of fiddly details.
>
> This is good, except that if you just pack things
> together in the simplest and most obvious way, the
> results are awful -- everything is jammed together,
> and nothing resizes the way you want. To get a layout
> which looks good and works properly, you need to deal
> with another set of fiddly details, namely the various
> padding, filling and expanding options, which (for
> me, anyway) seem to work in very unintuitive ways.
>
> The idea of an automatic layout manager is as good
> one, but I don't think that any of Tk's geometry
> managers are a good implementation of it. I'm not
> surprised that some people find them frustrating.

I'm currently in the middle of (or to be more accurate, near the
start of), writing a system that will hopefully allieviate this
probelm -- it's a GUI design language with multiple back ends,
one of which will be Python/tkinter.

--
Phil Hunt....philh@vision25.demon.co.uk