Created
July 31, 2017 15:17
-
-
Save anilsathyan7/40b7532813861a7306b79a08f4f9123c to your computer and use it in GitHub Desktop.
Python GUI Tkinter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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