source:
vendor/python/2.5/Demo/tkinter/guido/hello.py
| Last change on this file was 3225, checked in by , 19 years ago | |
|---|---|
| File size: 331 bytes | |
| Rev | Line | |
|---|---|---|
| [3225] | 1 | # Display hello, world in a button; clicking it quits the program |
| 2 | ||
| 3 | import sys | |
| 4 | from Tkinter import * | |
| 5 | ||
| 6 | def main(): | |
| 7 | root = Tk() | |
| 8 | button = Button(root) | |
| 9 | button['text'] = 'Hello, world' | |
| 10 | button['command'] = quit_callback # See below | |
| 11 | button.pack() | |
| 12 | root.mainloop() | |
| 13 | ||
| 14 | def quit_callback(): | |
| 15 | sys.exit(0) | |
| 16 | ||
| 17 | main() |
Note:
See TracBrowser
for help on using the repository browser.
