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).
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).
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:
- Frame_example.py: very simple canvas example
- presentation.py: little draw images and texts
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 🇧🇪🇫🇷🇬🇧 🐧 👨💻 👨🔬¶
🌐 Website: http://www.opimedia.be/
💾 Bitbucket: https://bitbucket.org/OPiMedia/
- 📧 olivier.pirson.opi@gmail.com
- Mastodon: https://mamot.fr/@OPiMedia — Twitter: https://twitter.com/OPirson
- 👨💻 LinkedIn: https://www.linkedin.com/in/olivierpirson/ — CV: http://www.opimedia.be/CV/English.html
- other profiles: http://www.opimedia.be/about/
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.
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
andsimpleplot
modules that reimplementcodeskulptor
,numeric
,simplegui
andsimpleplot
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¶
- Package SimpleGUICS2Pygame
- All modules of this package
- codeskulptor — replace the codeskulptor module of CodeSkulptor
- codeskulptor_lib — some miscellaneous functions
- numeric — replace the numeric module of CodeSkulptor
- simplegui_lib — simply import the following modules
- simpleguics2pygame — the main module, replace the simplegui module of CodeSkulptor
- simpleplot — replace the simpleplot module of CodeSkulptor
- Compatibility
- Tips
- License: GPLv3
- Known bugs
- Developers
- ChangeLog
- List of online programs
- List of online images
- List of online sounds
- Index