[Tutor] Building input for a function call

David Hutto smokefloat at gmail.com
Fri Nov 12 22:09:12 CET 2010


Fixed with:

	def obOpMenu(self):
		self.oblist = self.canvas.find_withtag('object')
		self.list = []
		for item in self.oblist:
			self.itemname = self.canvas.gettags(item)
			if self.itemname[1] != 'default':
				self.list.append(self.itemname[1])
		self.objectsvars = str(self.list).strip('[]')
		self.var = StringVar(self.root)
		self.var.set(self.objectsvars[0])
		self.f1 = open('/home/david/pythonfiles/pythonscripts/roughdraftapps/kubit_kaaba/other.py','w')
		self.f1.write("""from Tkinter import *
def thisDef(frame,var):
	optionmenu = OptionMenu(frame,var,%s)
	optionmenu.grid(row = 1,column = 2)
	return optionmenu""" % (str(self.list).strip('[]')))
		self.f1.close()
		from other import *
		self.optionmenu = thisDef(self.frame,self.var)


More information about the Tutor mailing list