Re: Tkinter questions

Bruce Bon (bon@dax.jpl.nasa.gov)
Mon, 30 Jan 1995 15:00:24 -0800

Guido often or usually posts his answers to queries, but I suppose
he either didn't think these of general interest or just overlooked
them. His responses were, as usual, to the point and effective.
Here they are:

On Jan 26, 8:19pm, Guido.van.Rossum@cwi.nl wrote:
> Subject: Re: Tkinter questions
...
> > There was also the other question, about setting X resources to control
> > Tkinter window positions, etc. Or, to be specific, what is the X widget path
> > to any one of my Tkinter widgets? Any pointers to documentation or examples
> > that might clarify that issue?
>
> 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.
...
>-- End of excerpt from Guido.van.Rossum@cwi.nl

To recap the second question:
On Jan 19, 11:09am, Bruce Bon wrote:
> Subject: Tkinter questions
...
> 2. The top level of the GUI consists of a buttons which I would
> like to be able to organize into 2 rows. As shown in the
> excerpt, I tried placing each row into a Frame widget. The
> two Frame widgets were packed with side=top, and the Button
> widgets inside each Frame with side=left. Result is a
> single long row of buttons. I tried moving the creation
> and packing of the second row Frame immediately after
> the first row frame, which resulted in no change.
> What am I doing wrong?
...
> def createWidgets(self):
> #
> #
> # Create the button frame to hold first-row widgets
> self.row1 = Frame(self)
> self.row1.pack({ "side" : "top" })
> #self.row1.pack({ "side" : "top",
> # "expand" : "1" })
> #
> self.row1.Jval = Button(self,
> { "text" : "Joint Control",
> "command" : self.jval }) # *** invokes jval ***
> self.row1.Jval.pack({"side": "left"})
> #
...
>-- End of excerpt from Bruce Bon

On Jan 26, 1:23pm, Guido.van.Rossum@cwi.nl wrote:
> Subject: Re: Tkinter questions
> Bruce,
>
> I think I've found the problem with your two rows of buttons. Instead
> of
>
> self.row1.Jval = Button(self,
> ...
>
> you should use
>
> self.row1.Jval = Button(self.row1,
> ...
>
> (for all buttons) so that not only Python but also the Tk geometry
> manager knows about the fact that this button is contained in the
> "row1" frame.
...
>-- End of excerpt from Guido.van.Rossum@cwi.nl

-- 
  ______________________________________________________________________

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