SimpleGUICS2Pygame package’s documentation

It is primarily a standard Python (2 and 3) module reimplementing the SimpleGUI particular module of CodeSkulptor2 and CodeSkulptor3 (a Python browser environment). This is in fact a package also with other modules adapted from CodeSkulptor.

Simply change

import simplegui

by

try:
    import simplegui
except ImportError:
    import SimpleGUICS2Pygame.simpleguics2pygame as simplegui

in your CodeSkulptor program and your program run both in CodeSkulptor and standard Python with this module (and Pygame).

SimpleGUICS2Pygame

Online HTML documentation on Read The Docs. (You can also see the online SimpleGUI documentation on CodeSkulptor2 or SimpleGUI documentation on CodeSkulptor3.)


If you have some problem

First, read this short main documentation page, this Compatibility page and this Tips page.

If you have problem with some command, you can see its documentation in the modules page or by the Index page .

Next, you can search in Stack Overflow. If you don’t find answer, you can ask question like this.

Finally you can email me. I will try to help you with pleasure. (You can write me in French.)

Installation

Before the installation of SimpleGUICS2Pygame

Obviously you need Python.

If pip (the Python Package Installer) is not installed on your system, then install it with:

$ python -m ensurepip --user

Note that $ represents the prompt and do not be entered by you.

If several Python implementations are installed, maybe you must use something like python2 or python3 instead python command.

With the --user option the installation is made in the user directory and doesn’t require administrator rights.

Before installation, as a precaution, upgrade necessary installation packages:

$ python -m pip install pip setuptools wheel --user --upgrade

Installation of SimpleGUICS2Pygame

$ python -m pip install SimpleGUICS2Pygame --user --upgrade

Followed requirements are automatically installed.

But if the installation failed, then install them separately and after that try again to install SimpleGUICS2Pygame.

On Arch Linux you can use this package installation script (written by Danny Fajardo): Arch_Linux/PKGBUILD.

Package pygame required

Pygame is required to use module simplegui_lib (and its submodules) and module simpleguics2pygame of SimpleGUICS2Pygame (except for the Timer class).

Warning

Normally Pygame is installed automatically when you install SimpleGUICS2Pygame. But if it is failed then install it like this first.

$ python -m pip install pygame --user --upgrade

If you have some problem, see installation documentation of pygame.

On Window$ you can also directly install a binary from the Unofficial Windows Binaries for Python Extension Packages: Pygame binary.

Package audioread required

audioread is required to play MP3 sounds (other sounds are played by Pygame).

Warning

If audioread is correctly installed on your system but playing MP3 fails, it is probably because some external dependency is missing. Try to install FFmpeg (executable ffmpeg must be accessible in your path) or other library used by audioread.

Package matplotlib required

matplotlib is required to use module simpleplot of SimpleGUICS2Pygame.

If you have some problem, see installation documentation of matplotlib.

On Window$ you can also directly install matplotlib binary.

Test installation

You can run the little script SimpleGUICS2Pygame_check.py to check if all required modules are installed.

Examples of result with good installation: result in Python 2 and result in Python 3.

You can also test your Pygame installation alone with the other little script pygame_check.py.

Examples of CodeSkulptor and SimpleGUICS2Pygame use

You can see examples in SimpleGUICS2Pygame/example/ subdirectory from the sources archives.

Or online: Python programs running in CodeSkulptor .

On some environments CodeSkulptor2 maybe runs too slow with Firefox. CodeSkulptor3 is better, but maybe too slow too. In these cases, use Chrome.

Two simple online examples:

Message to developers

This is a free software, so you can download it, modify it and submit your modifications. You can also redistribute your own version (keeping the GPL license).

Complete sources on Bitbucket: https://bitbucket.org/OPiMedia/simpleguics2pygame

See developers’page.

Author: 🌳 Olivier Pirson — OPi OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬

🌐 Website: http://www.opimedia.be/

💾 Bitbucket: https://bitbucket.org/OPiMedia/

Support me

This program is a free software (GPL license). It is completely free (like “free speech” and like “free beer”). However you can support me financially by donating.

Click to this link Donate Thank you!

Note that

  • SimpleGUI of CodeSkulptor2 (Scott Rixner) is a specific module of CodeSkulptor2, written in JavaScript.

    CodeSkulptor is a Python implementation running in a browser. It implements a subset of Python 2. It is the environment used in the course An Introduction to Interactive Programming in Python (Rice University, Coursera).

  • SimpleGUI of CodeSkulptor3 (Scott Rixner) is the same in the new version CodeSkulptor3 that implements a subset of Python 3.

  • SimpleGUICS2Pygame (Olivier Pirson) is this package. It is fully compatible with Python 2 and 3.

    It contains codeskulptor, numeric, simpleguics2pygame and simpleplot modules that reimplement codeskulptor, numeric, simplegui and simpleplot modules of CodeSkulptor.

    simplemap is not implemented.

    Warning

    SimpleGUICS2Pygame was designed to mimic behavior of CodeSkulptor. So load_image() and load_sound() methods can load medias only from URL, not local files. However SimpleGUICS2Pygame can save these medias to a specific local directory. See the Download medias tips.

    You can also use specific _load_local_image() and _load_local_sound() methods to load local files. But be careful, each specific method doesn’t exist in CodeSkulptor.

    There exist some little differences between SimpleGUICS2Pygame and SimpleGUI of CodeSkulptor. See Compatibility notes.

  • SimpleGUITk (David Holm) is another implementation of SimpleGUI of CodeSkulptor, using Tkinter and some others packages. It is really less complete and not updated. However it works for some programs.

  • simplegui2pygamemodule (Jimmy Kumar Ahalpara) seems be another implementation of SimpleGUI of CodeSkulptor, but I have not tested it.

  • simplequi (Arthur Gordon-Wright) is another implementation of SimpleGUI of CodeSkulptor, using Qt/PySide2. It is a partial implementation that I have not tested.

Warning

  • simplegui (Florian Berger) is a Python package which has the same name as SimpleGUI of CodeSkulptor, but it is totally something else.
  • PySimpleGUI is also a Python package that is totally something else.

Table of contents

Indices and tables