Web Analytics Made Easy - Statcounter
Skip to content

PySimpleGUI - The Tkinter Port

Call Reference PySimpleGUI (tkinter)

The primary port of PySimpleGUI uses tkinter. To use this port, you will pip install PySimpleGUI and import PySimpleGUI.

This port has had the most development effort put into it. It also has the largest group of users among the 4 ports. When new features are added to the tkinter port, they tend to be architected in a way that will work with the other ports.

Some Elements are unique to the tkinter port. These include:

  • Pane
  • OptionMenu

Additionally, a number of the Pseduo-elements have not yet been added to the other ports. Some examples are:

  • Custom Titlebar
  • MenubarCustom
  • Push (in the Qt port, the Stretch element can be used instead)

Installing

PySimpleGUI is installed via pip.

To install PySimpleGUI you will run:

python -m pip install PySimpleGUI

If you use the command python3 on your computer to invoke Python, then you'll run python3 instead of python:

python3 -m pip install PySimpleGUI

Importing

To use PySimpleGUI, you will use this import statement:

import PySimpleGUI as sg

System Tray

There is an implementation of the SystemTray object and feature set in the tkinter port itself, but it will not display an icon in the system tray itself. Instead an "icon" is placed on the desktop.

The PySimpleGUI project's psgtray library adds a system tray icon in the system tray. You will need to install this library separately from PySimpleGUI. More information on this pacakge can be found in the System Tray section.

tkinter Installation

Depending on your Operating System, how you get tkinter onto it will vary. Windows is the easiest and will happen automatically when you install Python. Linux often requires an explicit install of tkinter and Mac varies in how tkinter is supplied.

The one universal constant for all installations is that unlike the other 3 ports of PySimpleGUI, you will not install the underlying GUI framework, tkinter, via pip.