Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Tkinter is the standard Python interface to the "Tk" graphical user interface toolkit.

Tkinter is the standard Python interface to the Tk graphical user interface (GUI) toolkit. Tkinter runs on all common Mac, Windows and Unix/Linux platforms, making it easy to create rich, cross-platform desktop applications with Python.

, the toolkit upon which Tkinter is based, is a mature, robust toolkit that has its roots in the language, but which can be used with many modern languages including , , and others. Tk provides a native look and feel on Windows, Mac and Unix platforms. For more information about the cross-platform and cross-language features of Tk visit

The following is a Python 2 sample program loosely based on the documentation example but modified to avoid a global import. In Python 3 it is needed to change the import statement, since the module was renamed to tkinter.

import Tkinter as tk
class Application(tk.Frame):
    def say_hi(self):
        print("Hello, world!")
    def __init__(self, master=None):
        tk.Frame.__init__(self, master)
        self.quit = tk.Button(self, text="QUIT", command=self.quit, fg="red")
        self.hello = tk.Button(self, text="Hello", command=self.say_hi)

root = tk.Tk()
app = Application(root)
app.pack(side="top", fill="both", expand=True)

Due to its power and maturity, tools such as EasyGUI (no longer maintained) have been written on top of Tkinter to make it even easier to use.