Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate SimpleGUI with Python 2.7 and 3.0 shell

I am learning Python from Coursera. In this course they use SimpleGUI module on CodeSkulptor. Can anyone tell me how to integrate SimpleGUI with python 2.7 and 3.0 shell?

like image 357
Tahmeedbuet Avatar asked May 05 '13 18:05

Tahmeedbuet


People also ask

What is Simplegui?

Long story short, simplegui is a simplified GUI generator using Tkinter. I was attending a course from Coursera named An Introduction to Interactive Programming in Python (Part 1). You can follow the exercise by using CodeSkulptor that runs Python programs in your browser.


2 Answers

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.

like image 50
Pedro Guerreiro Avatar answered Oct 11 '22 10:10

Pedro Guerreiro


You can use my

enter image description hereSimpleGUICS2Pygame 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.
like image 43
Olivier Pirson Avatar answered Oct 11 '22 10:10

Olivier Pirson