PySimpleGUI - Environment Setup



PySimpleGui supports both Python 3.x versions as well as Python 2.7 version. The main port, PySimpleGui doesn’t have any external dependencies, as Tkinter - on which it is based - is a part of Python’s standard library, and hence it needn’t be installed separately. Install it in the current Python3 environment by the PIP installer as follows

pip3 install PySimpleGUI

To verify if the library is correctly installed, enter the following statement −

>>> import PySimpleGUI
>>> PySimpleGUI.version
'4.60.1 Released 22-May-2022'

In case, the PIP installation doesn’t work, you can download "pysimplegui.py" from the Github repository (https://github.com/PySimpleGUI/PySimpleGUI) and place it in your folder along with the application that is importing it.

The pysimplegui.py file has the "main()" function. When called from Python prompt, it generates the following window to affirm that the package is correctly installed.

>>> import PySimpleGUI as psg
>>> psg.main()
Starting up PySimpleGUI Diagnostic & Help System
PySimpleGUI long version = 4.60.1 Released 22-May-2022
PySimpleGUI Version 4.60.1
tcl ver = 8.6 tkinter version = 8.6
Python Version 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018,
00:16:47) [MSC v.1916 64 bit (AMD64)]
tcl detailed version = 8.6.6
PySimpleGUI.py location F:\python36\lib\sitepackages\PySimpleGUI\PySimpleGUI.py

The GUI window appears as below:

Environment Setup

If you are using Python3 version earlier than 3.4, you may need to install the "typing" module since it is not shipped in the corresponding standard library

pip3 install typing

For Python 2.7, change the name to PySimpleGUI27.

pip3 install PySimpleGUI27

You may need to also install "future" for version 2.7

pip3 install future

However, it is important to note that Python Software Foundation doesn’t officially support Python 2.x branches.

Advertisements