Created
April 16, 2013 12:36
-
-
Save timtan/5395557 to your computer and use it in GitHub Desktop.
wow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __author__ = 'tim' | |
| import Tkinter | |
| root = Tkinter.Tk() | |
| screen = Tkinter.Label(root) | |
| screen.pack() | |
| buttons = Tkinter.Frame(root) | |
| buttons.pack() | |
| class Command: | |
| def __init__(self, screen, button): | |
| self.button = button | |
| self.screen = screen | |
| def click(self): | |
| self.screen['text'] += self.button['text'] | |
| for i in range(10): | |
| button = Tkinter.Button(buttons, text=str(i)) | |
| command = Command(screen, button) | |
| button.config(command=command.click) | |
| button.grid(row=(i/3), column=(i%3)) | |
| root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment