python 2.7 - Can you assign more than one command to a Tkinter OptionMenu? -


i have following optionmenu:

    self.wcartsn = stringvar(self.frame1)                                                       self.e1 = optionmenu(self.frame1, self.wcartsn, *watercarts, command=(self.wcart, lambda selection:self.other_entry(selection,'wcartsn',10,6)))        self.e1.grid(row=10, column=5, stick=e+w) 

this doesn't work, makes question clear. how (if possible) call multiple functions 1 optionmenu? function gives error typeerror: 'tuple' object not callable

you create function calls each of multiple functions in turn:

def compose(functions):     """     returns single function composed multiple functions.     calling returned function execute each of functions in order gave them.     """     def f(*args, **kargs):         function in functions:             function(*args, **kargs)     return f   self.e1 = optionmenu(self.frame1, self.wcartsn, *watercarts, command=compose(self.wcart, lambda selection:self.other_entry(selection,'wcartsn',10,6)))    

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -