What Is Tkinter?

From TRCCompSci - AQA Computer Science
Jump to: navigation, search

The Tkinter module is the standard Python interface to the Tk GUI toolkit. It's one of the most popular GUI toolkits to use in Python, and is installed by default when you install Python on most platforms.

You can test if Tkinter is properly installed on your system by running "python -m Tkinter" from the the command line. This should open a window demonstrating a simple Tk interface, letting you know it's installed and working. (It'll also show you which version is installed so you can refer to documentation specific to your version.)

Importing

As with any Python module, when working with Tkinter, you must first import the library, which is simply done by the following line of code;

from tkinter import *