Skip to content

Instantly share code, notes, and snippets.

@walterrenner
Created February 1, 2013 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walterrenner/4690491 to your computer and use it in GitHub Desktop.
Save walterrenner/4690491 to your computer and use it in GitHub Desktop.
Basic Python GUI
#!/usr/bin/env python
from Tkinter import *
import tkMessageBox
from datetime import datetime
pressed = 0
def helloCallBack():
global pressed
pressed += 1
tkMessageBox.showinfo("Hello Python", "its %ssand you pressed me %i times" % (str(datetime.now()), pressed))
root = Tk()
helloButton = Button(root, text="Hello", width=60, command=helloCallBack)
quitButton = Button(root, text="Quit", width=60, command=quit)
helloButton.pack()
quitButton.pack()
root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment