Skip to content

Instantly share code, notes, and snippets.

@lfalanga
Last active January 28, 2020 03:06
Show Gist options
  • Save lfalanga/00f672b24c4948e75337ee822a8c91d2 to your computer and use it in GitHub Desktop.
Save lfalanga/00f672b24c4948e75337ee822a8c91d2 to your computer and use it in GitHub Desktop.
# Example 1: Displaying a simple Hello, World! label
from tkinter import *
Label(text='Hello, World!').pack()
mainloop()
# Example 2: Displaying an entry (field) in Tkinter window
from tkinter import *
root = Tk()
e = Entry(root)
e.pack()
e.focus_set()
a = 5
b = 2
c = a * b
var = IntVar()
e.config(textvariable=var)
var.set(c)
mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment