Skip to main content

Python GUIs for Humans

psgtest

Simple Python Testing

Run your Python programs using the interpreter version of your choice, and display the output in a GUI window.

example

Installation

Old-school Straight Pip

pip install psgtest

pip via python -m pip the python recommended way

If python is your command

python -m pip install psgtest

If python3 is your command

python3 -m pip install psgtest

Usage

Once pip installed, you can launch psgtest by typing on the command line:
psgtest

You can also create a Windows shortcut by following the instructions below.

About

This is an example of another utility used in the development of PySimpleGUI that is being released for other PySimpleGUI users to use either as a standalone tool or as example code / design pattern to follow.

It can be challenging to manage multiple versions of Python and the need to test across multiple versions. Virtual Environments are one approach that are often used. psgtest does not use virtual environments. Instead, it invokes the Python interpreter of your choice directly.

The advantage is that changing which version of Python that's used is changed in a single drop-down menu selection as shown in the example GIF above. The session in the GIF shows launching the PySimpleGUI main test harness using multiple versions of Python by selecting the version from the drop-down at the top.

Executing Multiple Programs

To run multiple programs, select the files to run from the list of files on the left portion of the window. Then click the "Run" button.

Editing Programs

You can also edit the programs selected by clicking the "Edit" button. You will need to set up your editor using the PySimpleGUI global settings. If you have pip installed a version of PySimpleGUI that's 4.53.0.14 or greater, then you can type psgsettings from the command line. You can also change the settings by calling sg.main() (or typing from the command line psgmain).

Specifying/Selecting Python Interpreter Locations

The Setup Window is where you enter the path to each version of Python that you want to test with. The settings are stored in a file and thus will be saved from one run to another.

Selecting the version to use can be done in either the settings window or using the drop-down menu in the main window.

Output

The stdout and stderr from each program you execute are displayed in a tab with a name that matches your filename. Each program you run will open a new tab.

In each tab you'll find 2 buttons that operate on the output shown in that tab.

Use the Copy To Clipboard button to copy the contents of the output to the clipboard.

Use the Clear button to delete the output.

The Close Tab button closes the tab as does the right click menu item Close. If you run the program again after closing the tab, the old contents of the tab are retained and shown when the tab is "re-opened". (See the GIF above for an example)

Make a Windows Shortcut

If you're running Windows, then you can use psgshortcut to make a shortcut to the .pyw file (if you download psgtest from GitHub) or the .py file (if you pip installed). The icon for psgtest is in this repo and is also included when you pip install psgtest. It's in the same folder as the gui.py file.

You can find the location of psgtest after pip installing it by running psgtest, right clicking, and choosing "File Location". You'll be shown where the gui.py file is located (the name of the psgtest program when pip installed). It will usually be located in the site-packages folder in a folder named psgtest.

Instructions on how to make shortcuts to pip installed PySimpleGUI programs can be found in description for psgshortcut on PyPI.

Release Notes

1.9.0

  • Fix for exception when no settings are initially found. Oy.... bad bug to have released reight away
  • Will create a settings file with the currently running version of Python if one is not found
  • Added minimum of 4.55.1 requirement for PySimpleGUI to the setup.py file

1.8.0

  • Support for Python 3.4, 3.5, 3.11 added to settings
  • Set the settings filename to be psgtest instead of the default filename. This is needed because the file for these psg projects on PyPI are all name gui.py and thus will have all point to the same settings file if not explicitly set
  • Only show configured interpreters in the Combo in main window

License

Licensed under an LGPL3 License

Designed and Written By

Mike from PySimpleGUI.org

Contributing

Like the PySimpleGUI project, this project is currently licensed under an open-source license, the project itself is structured like a proprietary product. Pull Requests are not accepted.

Copyright

Copyright 2021 PySimpleGUI

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psgcompiler-1.0.0.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

psgcompiler-1.0.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file psgcompiler-1.0.0.tar.gz.

File metadata

  • Download URL: psgcompiler-1.0.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.0 pkginfo/1.4.2 requests/2.26.0 requests-toolbelt/0.8.0 tqdm/4.62.0 CPython/3.6.2

File hashes

Hashes for psgcompiler-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c322b9edd429ec011b616a5b8602986e49746f0756d4ae8494ae0a6c28f24164
MD5 c49b254ebc3582fe866f66c11a67e6c8
BLAKE2b-256 fb604b0d5c4997be09b0d960ea362596bf4f3b4e9dd9269b674dcb7ecb32073c

See more details on using hashes here.

File details

Details for the file psgcompiler-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: psgcompiler-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.0 pkginfo/1.4.2 requests/2.26.0 requests-toolbelt/0.8.0 tqdm/4.62.0 CPython/3.6.2

File hashes

Hashes for psgcompiler-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bbe2823c70b1bfe893d3410ad72807f71b553b3822c9d042068c82f4b42de6f4
MD5 a76a1b29857847f4def209ac589b2ca2
BLAKE2b-256 de1018e8715563b27b91e64c4e5a354e0fd94635dd9b2c44a169c4419e0ff3bc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page