[Tutor] Building input for a function call

David Hutto smokefloat at gmail.com
Fri Nov 12 19:21:40 CET 2010


This is a more precise question, the above was after trying different methods,
and it got a little confusing.

Why in the below does using in line 12:self.objectsvars =
'menuitemhere','menuitemhere','menuitemhere','menuitemhere', not work,
but placing 'menuitemhere','menuitemhere','menuitemhere','menuitemhere'
in line 17 directly work?


	def obOpMenu(self):
		print 'Dummy' #This is my tony robins help
		import time
		self.oblist = self.canvas.find_withtag('object')
		print self.oblist
		self.list = []
		for item in self.oblist:
			self.itemname = self.canvas.gettags(item)
			if self.itemname[1] != 'default':
				self.list.append(self.itemname[1])
		print self.list
		self.objectsvars = 'menuitemhere','menuitemhere','menuitemhere','menuitemhere'
		print type(self.objectsvars[0])
		self.var = StringVar(self.root)
		self.var.set(self.objectsvars[0])

		self.optionmenu = OptionMenu(self.frame,self.var,self.objectsvars)
		self.optionmenu.grid(row = 1,column = 2)


Hope that's clearer:)


More information about the Tutor mailing list