Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: 4bd1cefca9e1e4925c25c8119790288b89e7a52d authored by Barry Warsaw on 18 July 2008, 02:28:44 UTC
Bumping to 3.0b2
Tip revision: 4bd1cef
hello.py
# Display hello, world in a button; clicking it quits the program

import sys
from Tkinter import *

def main():
    root = Tk()
    button = Button(root)
    button['text'] = 'Hello, world'
    button['command'] = quit_callback       # See below
    button.pack()
    root.mainloop()

def quit_callback():
    sys.exit(0)

main()
back to top