Hi Everybody,

Can someone please tell me how to pass a frame to other class method
I am able to pass the frame but when i pack some entry field..the window stops responding
here is my code

class InfoFrame:
    def addAttributeCriteria(self, parent = None, type = '', attrib = {}, cascade = True):
		print "called Info frame addattributecriteria"
		'''Description: If adding the first attribute frame this method will add the frame to parent and initialize self.growingFrame.
		All subsequent attribute frames will be added to self.growingFrame and will have a delete button.
		parent --> the parent frame of this attribute frame.
		type --> if filling in an attribute this is its component type (model, mesh, nodes, etc.)
		attrib --> dictionary with each attribute value keyed with its type
		cascade --> boolean value indicating whether or not this attribute applies to all child components
		return --> None
		#if parent is None then add the attribute to growingFrame and make a delete button.
		if parent == None:
			makeDeleteButton = True
			parent = self.growingFrame
		#end if
		#otherwise add root attribute to parent and do not make a delete button.
			makeDeleteButton = False
		#end else
		#make and add attribute group
		gp = Pmw.Group(parent, tag_text = 'Attribute')
		f = gp.interior()
		gp.pack(fill = 'x', expand = 1, padx = 4)
		topF = Frame(f)
		#make delete button and connect it to deleteAttributeCriteria
		deletebtn = Button(topF, image = self.blueminus, command = lambda :self.deleteAttributeCriteria(gp, topF),
			state = self.entryStates(), takefocus = 0)
		#make menu bar
		menuBar = Pmw.MenuBar(topF, hull_relief = 'raised',hull_borderwidth = 1)
		#assign root name to given type or just 'model'
		rootName = 'Model>'
		if type != '':
			rootName = MenuOptions[type] + Comp
		#end if
		#get our global MenuTree with all available components and assign our new root name
		global menuNames
		menuNames.name = rootName
		#create our attribute menu
		self.createMenu(menuBar, rootName, menuNames, rootName, topF)
		#disable menuBar if everything else is disabled (calling from RetreiveForm)
		if self.entryStates() == 'disabled':
		#end if
		#create attribute component menu label
		attLabel = Label(topF, text = '  Component:', takefocus = 0)
		#create cascade select radiobutton
		attrib_cscd_radio = Pmw.RadioSelect(topF, buttontype = 'checkbutton')
		attrib_cscd_radio.add('Assign attribute to any child\nclasses, objects, or sub-objects',
			state = self.entryStates(), disabledforeground = 'black', takefocus = 0)
		#add delete button if this is not the root attribute frame
		if makeDeleteButton:
			deletebtn.grid(row = 0, column = 0, padx = 3, sticky = W)
		#end if
		#add the attribute component menu label, attribute component menu, and cascade radiobutton
		attLabel.grid(row = 0, column = 1, sticky = W)
		menuBar.grid(row = 0, column = 2, sticky = W)
		attrib_cscd_radio.grid(row = 0, column = 3, padx = 9, sticky = E)
		topF.columnconfigure(0, weight = 0, minsize = deletebtn.cget('width'))
		topF.columnconfigure(1, weight = 0)
		topF.columnconfigure(2, weight = 1)
		topF.columnconfigure(3, weight = 1)
		topF.pack(fill = 'x', expand = 1)
		#create and add frame to hold attribute values
		#save this attribute row
		self.attribRows[topF] = [rootName, attrib_cscd_radio, {}]
		#Create a cascading menu button for adding attribute types
		#get our global MenuTree with all available components and assign our new root name
		AttTypemenuBar = Pmw.MenuBar(topF, hull_relief = 'raised',hull_borderwidth = 1)
		aname = "Add Attribute Type"
		self.createAttTypeMenu(AttTypemenuBar, topF, aname = aname)
		AttTypemenuBar.grid(row = 1,column = 2, sticky = W)
		topF.pack(fill = 'x', expand = 1)
		#create each attribute entry field
		if attrib:
			for type,text in attrib:
				self.addattributeTypeCriteria(topF, type, text)
		#invoke cascade select if specified
		if cascade:
		#end if
		self.mainAttributeFrame.yview(mode = 'moveto', value = 1.0)
		#create our growingFrame for next time if this is the root attribute we are adding.
		if not hasattr(self, 'growingFrame'):
			self.growingFrame = Frame(parent)
			self.growingFrame.pack(fill = 'x', expand = 1)
	#end def addAttributeCriteria
	def addattributeTypeCriteria(self, cFrame, fieldtype, fieldtext):
		print "fieldtype is:",fieldtype
		print "fieldtext is:",fieldtext
		print "frame in attributetypecriteria is:",cFrame
		#create attribute type field label
		entry = Pmw.EntryField(cFrame, sticky = 'we', labelpos = 'w', label_text = fieldtype + ':',
				entry_width = 10, entry_disabledbackground = 'white', entry_disabledforeground = 'black')
		if fieldtext != '':
		self.attribRows[cFrame][2][fieldtype] = entry
		cFrame.pack(padx = 4, pady = 2, fill = 'both', expand = 1)
	#end def addattributeTypeCriteria
	def createAttTypeMenu(self, AttTypemenuBar, rFrame, aname):
		print "called Info frame createatttypemenu"
		'''Description:  adds menu nodes to a Pmw.MenuBar.
		AttTypemenuBar --> A Pmw.MenuBar to add children to
		parentName --> The parent of this component we are adding
		rootFrame --> parent frame of this menu
		return --> None
		print "frame in createatttypemenu is:",rFrame
		if aname == "Add Attribute Type":
			AttTypemenuBar.addmenu(aname, 'Click to add attribute type')
			for key in AttributeTypes.keys():
				AttTypemenuBar.addcascademenu(aname, key, traverseSpec = 'z', tearoff = 1)
				for skey in AttributeTypes[key]:
					if skey in SubAttributeTypes.keys():
						AttTypemenuBar.addcascademenu(key,PrettyAttTypes[skey],traverseSpec = 'z', tearoff = 1)
						for smkey in SubAttributeTypes[skey]:
							AttTypemenuBar.addmenuitem(PrettyAttTypes[skey], 'command', command = HandleTypeSelection(self, AttTypemenuBar, rFrame, PrettyAttTypes[smkey]) , label = PrettyAttTypes[smkey])
						AttTypemenuBar.addmenuitem(key,'command', command = HandleTypeSelection(self, AttTypemenuBar, rFrame, PrettyAttTypes[skey]), label = PrettyAttTypes[skey])
			print "yet to be implemented"
	#end def AttTypecreateMenu
class HandleTypeSelection:
	def __init__(self, sdf, AttTypemenuBar, refFrame, text):
		self.sdf = sdf
		self.AttTypemenuBar = AttTypemenuBar
		self.refFrame = refFrame
		print"freme in handletypeselection is:",refFrame
		self.text = text

	def __call__(self):
		print "Attribute Type Selected:", self.text
		print"frame in call in handletypeselection is:",self.refFrame
		self.sdf.addattributeTypeCriteria(self.refFrame, fieldtype = self.text, fieldtext = '')

I am new to python,please help me

This article has been dead for over six months. Start a new discussion instead.