I wold like to be able to generate buttons from a list in a file. How would I go about making each button have a different command, Lets say make the button print its label instead of print "."
The problem I have is I don't know what the list is going to be until it is opened or how big so I carnet make a def for each. And I don't know how to do it with a loop Thanks ------Code------- from Tkinter import * class App: def __init__(self, root): self.DisplayAreaListsFrame = Frame(root) self.DisplayAreaListsFrame.pack() Lists = ["A1","B2","C3","D4"] for i in Lists: self.DisplayAreaListButton = Button( self.DisplayAreaListsFrame, text=i, command=self.ListButtonCommand) self.DisplayAreaListButton.pack(side=LEFT,padx=10) def ListButtonCommand(self): print "." root = Tk() app = App(root) root.mainloop() -- http://mail.python.org/mailman/listinfo/python-list