Re: passing menu label to function

2009-08-07 Thread J Wolfe
Thanks Peter, I figured out an alternative just as you posted your response, I just looped through the buttons I wanted to add and used the loop variable to label the item and then passed it to the function, though your way seems much more robust. Thanks a lot! -- http://mail.python.org/mailman

Re: passing menu label to function

2009-08-07 Thread Peter Otten
J Wolfe wrote: > I would like to pass the label name of a menu to the command it is > calling, is that possible? > > self.menuitem.menu.add_command(label="pass this",command = lambda i = > self.self.menuitem.menu.cget("label"): self.function(i)) > > def function(self, i) > print i # print

passing menu label to function

2009-08-07 Thread J Wolfe
Hi, I would like to pass the label name of a menu to the command it is calling, is that possible? self.menuitem.menu.add_command(label="pass this",command = lambda i = self.self.menuitem.menu.cget("label"): self.function(i)) def function(self, i) print i # print the label name Any help