How to integrate SimpleGUI with Python 2.7 and 3.0 shell
You can use my
SimpleGUICS2Pygame package.
Objectively, this is the best solution :-)
The package implement simplegui, codeskulptor, numeric and simpleplot modules.
If your Python tools are up to date, it is easy to install:
python -m pip install SimpleGUICS2Pygame --user --upgrade
- Online HTML documentation: https://simpleguics2pygame.readthedocs.io/
- Installation: https://simpleguics2pygame.readthedocs.io/en/latest/#installation
- Sources: https://bitbucket.org/OPiMedia/simpleguics2pygame
In your code, replace the import command
import simplegui
by
try:
import simplegui
except ImportError:
import SimpleGUICS2Pygame.simpleguics2pygame as simplegui
and your code run in CodeSkulptor and in standard Python (2 and 3) with this package.
Note that:
- SimpleGUITk is an other implementation, using Tkinter and some others packages. It is really less complete and not updated. However it works for some programs.
- simplegui is a Python package which has the same name as SimpleGUI of CodeSkulptor, but it is totally something else.
From the coursera forums by Darren Gallagher
From the CodeSkulptor Documentation:
http://www.codeskulptor.org/docs.html
"... implements a subset of Python 2.6...CodeSkulptor's Python is not a subset in one respect...Implemented on top of JavaScript..."
I don't think that CodeSkulptor / SimpleGUI is a Python Module, as we know it. It is written on top of Javascript to allow the user output to their web browser, as opposed to their desktop and/or interpreter window.
The module I have found / used in Python that is most similar to SimpleGUI is Pygame - in both syntax and display. It requires a little more to get a project 'running' but is definitely worth investing time in. I'm sure what we will learn in the coming weeks with SimpleGUI will be very transferable.
The full thread can be found here Can the staff give us the SIMPLEGUI module? (Note need to be enrolled to the course to view the link)
A python package called SimpleGUICS2Pygame has since been created to run CodeSkulptor code using Pygame, I haven't tried it myself yet but it can be found here
You can just use SimpleGUITk (http://pypi.python.org/pypi/SimpleGUITk) which implements a Tk version of simplegui.
To use your CodeSkulptor code in the desktop, you just need to replace
import simplegui
with
import simpleguitk as simplegui
and that's it, your program made for CodeSkulptor code should work on the desktop.