Tkinter questions

Bruce Bon (bon@dax.jpl.nasa.gov)
Thu, 19 Jan 1995 11:09:09 -0800

I am developing a Tkinter-based GUI and have run into a couple
of problems. A simplified excerpt from my program is at the
end of this message.

1. The GUI has a set of buttons which invoke popup control
displays. I would like to set X resources for geometry
so that the user doesn't have to position the popup's
every time, but I don't know the path to specify. For
the example in the excerpt, I have tried:

*w.geometry: -20+70
*w*geometry: -20+70
*popup.geometry: -20+70
*popup*geometry: -20+70

I have tried to find the answer in Ousterhout's book, but
no luck. Anyone know what I should be using?

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?

Thanks for any help you can furnish.

Bruce Bon

---------------------------------------------------------------
def jval(self):
#
# Create the top-level window with titles
w = Toplevel(self)
self.popup = w
w.title( "Joint Value Control" )
w.iconname('JointVal')
...

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"})
#
self.row1.Cloc = Button(self,
{ "text" : "Cartesian Control",
"command" : self.cloc })
self.row1.Cloc.pack({"side": "left"})
#
self.row1.QUIT = Button(self,
{ "text" : "QUIT",
"command" : self.quit })
self.row1.QUIT.pack({"side": "left"})
#
#
# Create the button frame to hold second-row widgets
self.row2 = Frame(self)
self.row2.pack({ "side" : "top" })
#self.row2.pack({ "side" : "top",
# "expand" : "1" })
#
self.row2.Left = Button(self,
{ "text" : "Left Dexterous Arm",
"command" : self.leftarm })
self.row2.Left.pack({"side": "left"})
#
self.row2.Right = Button(self,
{ "text" : "Right Dexterous Arm",
"command" : self.rightarm })
self.row2.Right.pack({"side": "left"})
#
self.row2.Cam = Button(self,
{ "text" : "Camera Arm",
"command" : self.camarm })
self.row2.Cam.pack({"side": "left"})
#
---------------------------------------------------------------

-- 
  ______________________________________________________________________

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