Re: Using a geometry resource with the Tk packer

tnb2d@server.cs.Virginia.EDU
Wed, 1 Feb 1995 14:40:31 -0500

There is a method on the Wm class in Tkinter called "geometry"
that does exactly what you are looking for. Here's a little sample
that should get you on your way:

------------%< snip %<----------------------%< snip %<------------

(tnb2d@brunelleschi) /uf26/tnb2d $ python
Python 1.1.1 (Nov 17 1994)
Copyright 1991-1994 Stichting Mathematisch Centrum, Amsterdam
>>> from Tkinter import *
>>> b = Button()
>>> b['text'] = 'SPAM'
>>> b.pack()
>>> b.master.geometry('+1+1')
''
>>> b.master.geometry('+10+100')
''
>>> b.master.geometry('+100+100')
''

------------%< snip %<----------------------%< snip %<------------

All those geometry calls just pushed the window around the
screen.

Bruce Bon writes:
| This is actually a follow-on to an earlier question, which Guido answered
| in part with:
|
| > Im not sure what the path to the top level widget is (Ousterhout's
| > book or the wm man pages will explain that), but the internal widgets
| > normally have a nonsensical name made up of digits chosen at random
| > (actually it's the object's address :-). To override this, you can
| > add 'name': 'userDefinedName' to the config dictionary at widget
| > creation time.
|
| I took his suggestion, and Tk (3.6) definitely accesses the resource,
| but doesn't do what I want. Basically, I would like to position
| a popup window using an X resource. I used the following in my resource
| file:
|
| *jtcontrol.geometry: -20+70
|
| I know that Tk is seeing it, because it gives me the following error message:
|
| TclError: bad geometry "-20+70": expected widthxheight
|
| I tried adding a WxH field, even though I didn't want one. Result was that
| there was no more error message, but the geometry was completely ignored
| by the program.
|
| Is there a way to do this? I.e. to pre-position a popup on the screen?
|
| Thanks.
| Bruce
|
|
| --
| ______________________________________________________________________
|
| Bruce Bon Member Technical Staff
| Mail Stop 198-219 Automation and Control Section
| Jet Propulsion Laboratory Phone: (818) 354-4969
| 4800 Oak Grove Drive FAX: (818) 393-5007
| Pasadena, CA 91109-8099
|
| E-Mail: bon@telerobotics.jpl.nasa.gov OR bruce.bon@jpl.nasa.gov
| URL: http://robotics.jpl.nasa.gov/people/bon/homepage.html
|

-------> Tommy.
President,
the United States of Love