Pack parent control in child using control.pack(in_= syntax?

Discussion in 'Python' started by Tim Jones, Jan 31, 2004.

  1. Tim Jones

    Tim Jones Guest

    I've a parent class the generates a menu as in:

    self.tm.menu = Menubutton(self.main, relief=RAISED, width=20,
    bd=0, bg='#ECECEC')
    ...

    I can then pack this menu (self.tm) into the current parent
    window/frame and it appears as expected.

    However, if I call another class - tool_panel(self) and then try to
    post the tm menu into a frame (tf) using
    pack(in_=tf, side=RIGHT, anchor=NE)
    - the menu takes up space, but doesn't appear. I can see this because
    when I pack the icon logo without the menu, the logo is centered in
    the new frame. With the menu included, the icon logo is shifted left.

    Thoughts or guidance will be greatly appreciated.

    Tim

    ------------

    Here's my menu creation code in the parent class:

    self.tm = Menubutton(relief='raised', width=20,
    bd=0, bg='#ECECEC')
    self.tm.menu = Menu(self.tm, tearoff=0,
    title='Tool Option')
    self.tm['menu'] = self.tm.menu

    I set up the call to the tool_panel with a call:

    self.tool_panel = tool_panel(self)

    Here's the actual tool_panel that I wish to pack into (imported from
    another source file called panels.py with 'from panels import *'):

    class tool_panel(panel):

    def __init__(self, parent):
    panel.__init__(self, parent)
    tf = Frame(self.main)
    self.parent.tm.pack(in_=tf, side=RIGHT)
    self.logo = PhotoImage(data=images.icon)
    Label(tf, image=self.logo).pack(side=TOP)
    tf.pack(side=BOTTOM, fill=BOTH, expand=1)
    return

    def display(self):
    self.display0()
    return

    pass
    Tim Jones, Jan 31, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. davout
    Replies:
    0
    Views:
    549
    davout
    Apr 18, 2004
  2. Jeff Rodriguez
    Replies:
    23
    Views:
    1,116
    David Schwartz
    Dec 9, 2003
  3. Replies:
    0
    Views:
    207
  4. Noel Dolan
    Replies:
    0
    Views:
    228
    Noel Dolan
    Jul 18, 2004
  5. Bitswapper
    Replies:
    5
    Views:
    135
    Prasad, Ramit
    Aug 27, 2013
Loading...

Share This Page