Skip to content

Instantly share code, notes, and snippets.

@fnielsen
Created September 30, 2013 08:48
Show Gist options
  • Save fnielsen/6761017 to your computer and use it in GitHub Desktop.
Save fnielsen/6761017 to your computer and use it in GitHub Desktop.
Tkinter Hello world in Python
from Tkinter import *
def hello():
"""Callback function for button press."""
print "Hello World"
# Main root window
root = Tk()
# A button with a callback function
Button(root, text="Press here", command=hello).pack()
# .pack() method is necessary to make the button appear
# Event loop
root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment