Web Analytics Made Easy - Statcounter
Skip to content

Testing The Installation of PySimpleGUI

The PySimpleGUI "Home Window"

If you call sg.home() then you'll get the Home Window and can use the upgrade feature.

import PySimpleGUI as sg
sg.home()

After you've pip installed, you can use the commands psghome to open the Home Window or psgupgrade to invoke the development build upgrade code.

There have been problems on some machines when psgmain and psgupgrade are used to upgrade PySimpleGUI. The upgrade is in-place so there can be file locking problems.

The "Safest" approach is to call sg.main() from your code and then click the red upgrade button.

image

Recovering From a Bad Development Build Release

If you run into a problem upgrading after upgrading, you can likely use pip to uninstall, then re-install from PyPI to see if you can upgrade to a development build again.

pip uninstall PySimpleGUI
pip install PySimpleGUI

Testing your installation and Troubleshooting

Once you have installed, or copied the .py file to your app folder, you can test the installation using python.

The Quick Test

The PySimpleGUI Home Window pictured in the previous section on GUI upgrades is the short program that's built into PySimpleGUI that serves multiple purposes. It exercises many/most of the available Elements, displays version and location data and works as a quick self-test.

psghome or psgmain are the same command and you can enter either to the run PySimpleGUI Home Window if you pip installed. You can also use:

From your command line type: python -m PySimpleGUI

If you're on Linux/Mac and need to run using the command python3 then of course type that.

This will display the Home Window window.

You can also test by using the REPL....

Instructions for Testing Python 3:

>>> import PySimpleGUI
>>> PySimpleGUI.main()

You will see a "Home Window" that exercises the SDK, tells you the version number, allows you to try a number of features as well as access the built-in development build upgrade utility.

Finding Out Where Your PySimpleGUI Is Coming From

It's critical for you to be certain where your code is coming from and which version you're running.

Sometimes when debugging, questions arise as to exactly which PySimpleGUI you are running. The quick way to find this out is to again, run Python from the command line. This time you'll type:

>>> import PySimpleGUI as sg
>>> sg

When you type sg, Python will tell you the full patch to your PySimpleGUI file / package. This is critical information to know when debugging because it's really easy to forget you've got an old copy of PySimpleGUI laying around somewhere.

Finding Out Where Your PySimpleGUI Is Coming From (from within your code)

If you continue to have troubles with getting the right version of PySimpleGUI loaded, THE definitive way to determine where your program is getting PySimpleGUI from is to add a print to your program. It's that simple! You can also get the version you are running by printing.

import PySimpleGUI as sg

print(sg)
print(sg.version)

Just like when using the REPL >>> to determine the location, this print in your code will display the same path information.

Verifying Authenticity

Beginning with PySimpleGUI 5, all releases can be verified as being authentic and unaltered. When PySimpleGUI is imported it runs a self-test to see if there have been any modifications done to the software. If the code is found to be altered, you are shown a warning message and asked if you wish to continue executing your code.

Because PySimpleGUI is distributed as source code, it is possible for someone to alter the code in a way that goes unreported. To be sure your copy of PySimpleGUI has not been altered you can upload the code to our website and run a test to see if you have an authentic, and unaltered release.

For more information, check out the Security section.