Skip to content

Instantly share code, notes, and snippets.

@anilsathyan7
Created July 31, 2017 15:17
Show Gist options
  • Save anilsathyan7/40b7532813861a7306b79a08f4f9123c to your computer and use it in GitHub Desktop.
Save anilsathyan7/40b7532813861a7306b79a08f4f9123c to your computer and use it in GitHub Desktop.
Python GUI Tkinter
#GUI: Sample Program - Increment
import Tkinter
window = Tkinter.Tk()
window.title("Button_Label")
num = 0
#callback : function for changing label
def increment():
global num
num += 1
lbl.configure(text=num)      #update label object
#create label
lbl=Tkinter.Label(window, text=num)
lbl.pack()
#create button
btn=Tkinter.Button(window,text="Click Me",command=increment).pack()
window.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment