# SimpleGUICS2Pygame

It is primarily a standard Python (2 and 3) module reimplementing the SimpleGUI particular module of CodeSkulptor (a browser Python interpreter).

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 CodeSkulptor.)

## 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.

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.

## Installation

If pip is installed on your platform you can do:

>>> pip install SimpleGUICS2Pygame


(If several Python implementations are installed, maybe you must use something like pip2 or pip3 instead pip command.)

Without pip, download the archive SimpleGUICS2Pygame-?.tar.gz, unzip it somewhere. Next in the somewhere/SimpleGUICS2Pygame-?/ subdirectory run:

>>> python setup.py install


In both cases, you must use admin access. So with GNU/Linux you will probably do:

>>> sudo [your command]


Module simpleplot require matplotlib (and must be installed separately).

Modules simplegui_lib (and its submodules) and simpleguics2pygame (except for the Timer class) require Pygame (and must be installed separately).

### Test installation

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

Examples of 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 .

Two simple online examples:

## Message to developers

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

See developers'page.

## Support me

This package is a completely free software (GPL license). So it is completely free (like "free speech" and like "free beer"). However you can support me financially by donating.

Go to the link . Thank you!

Copyright (C) 2013, 2014, 2015, 2016 Olivier Pirson

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

## Note that

• SimpleGUI of CodeSkulptor (Scott Rixner) is a specific module of CodeSkulptor, 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).

• 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.

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.

Warning

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

## Changes

• 02.00.00 WORKING VERSION — Novembre 28, 2016
• Added a developer's page in documentation.
• Added --last command line option.
• Replaced _WEBSITE value by documentation link.
• Added script/pygame_check.py to check Pygame installation alone.
• Added ValueError exception if draw_text() try to draw a text containing unprintable whitespace character.
• Updated test/test_text.py.
• Added alpha possibility on background color.
• Improved dealing of input box.
• Updated simpleplot module, to "run" same if matplotlib is not installed.
• Updated test/test_objects.py.
• Corrected "Read the Docs" subpackage problem.
• Updated test/test_sound.py.
• Updated script/SimpleGUICS2Pygame_check.py.
• Splitted the big file simpleguics2pygame.py.
• Added _load_local_image() and _load_local_sound() functions.