Before you start building GUI applications with Tkinter you will need a working installation of Python & Tkinter on your computer. Helpfully, Tkinter is installed by default with every Python installation on Windows, so you don't need to install it separately. Just download and install Python and you will have Tkinter available to you.
See below for instructions on how to install Python if you do not already have it set up.
Installing Python on Windows
Go to the official Python website's Windows downloads page and download one of the Stable Releases of Python.
You can download any of the stable versions.
You typically want to download the Windows Installer (64-bit) for modern hardware. Unless you know you need the 32 bit version, try the 64-bit first.
Once the download is complete, double click the installer to launch it.
The Python for Windows installer. Ensure sure Add python.exe to PATH is checked.
You'll see the installer welcome screen which describes what the installer will do.
Make sure that Add python.exe to PATH is checked in the installer. This makes it easier to use Python from the command prompt -- you just need to enter "python" to start, rather than the full path to the executable.
When you are ready to being the installation you can click Install Now.
The install will proceed as normal, installing all the required libraries (including Tcl/Tk for Tkinter). Once complete you can exit the installer.
Open a command prompt and start python by entering
python. This will start the Python REPL, where you can enter interactive Python code.
The Python REPL for our newly installed Python installation.
You can enter
from tkinter import * to confirm that Tkinter has been installed and create a window with
Window = Tk() to confirm it is usable.
Importing Tkinter and creating a window in the Python REPL.
You can run Python scripts from the command prompt by entering
python followed by the script name. Create a file in your code editor and enter the following simple Tkinter example:
from tkinter import *
Window = Tk()
Save the file as
my_tkinter_app.py in your home folder
/Users/<your username>. You can now launch this from the command prompt -- as long as you are in the same folder as the script -- using
Running a Tkinter script from the command line.
That's it! You can now continue to the Tkinter tutorial to start creating your own Tkinter applications!