Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Pack parent control in child using control.pack(in_= syntax?

Reply
Thread Tools

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

 
 
Tim Jones
Guest
Posts: n/a
 
      01-31-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If a class Child inherits from Parent, how to implementChild.some_method if Parent.some_method() returns Parent instance ? metal Python 8 10-30-2009 10:31 AM
Parent/Child relations - Trying to access child control for save tnt_lu@hotmail.com ASP .Net Datagrid Control 0 04-15-2005 12:50 PM
Parent - Child back to parent javascript thingybob mark ASP .Net 1 03-10-2005 02:20 PM
Pass from parent to child, then update parent with child value... Noel Dolan Javascript 0 07-18-2004 05:52 PM
How do I: Main thread spawn child threads, which child processes...control those child processes? Jeff Rodriguez C Programming 23 12-09-2003 11:06 PM



Advertisments