Tkinter Examples

free amp template

What is Tkinter??

Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI toolkit, and is Python's de facto standard GUI. Tkinter is included with standard Linux, Microsoft Windows and Mac OS X installs of Python. The name Tkinter comes from Tk interface.

Blank Window

from tkinter import *
window = Tk()
window.title("Blank Window")
window.mainloop()

Label

from tkinter import *
window = Tk()
window.title("Label Example")
lbl = Label(window, text="Hello")
lbl.grid(column=0, row=0)
window.mainloop()

tk buttons 

These buttons are the standard buttons in tkinter these buttons are old looking so I recommend using ttk.

from tkinter import *
window = Tk()
window.title("tk buttons")
window.geometry('350x200')
lbl = Label(window, text="Hello")
lbl.grid(column=0, row=0)
btn = Button(window, text="Click Me")
btn.grid(column=1, row=0)
window.mainloop()

ttk buttons 

These buttons are more modern looking then the standard ttk buttons

from tkinter import ttk
from tkinter import *
ttk.Button(window, text=" SET ").grid(row=3, column=3, columnspan=4)
window.title("Blank Window")
window.mainloop()

Share this page

Contents

>