Cómo integrar SimpleGUI con Python 2.7 y 3.0 shell

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

preguntado el 05 de mayo de 13 a las 19:05

7 Respuestas

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

con

import simpleguitk as simplegui

and that's it, your program made for CodeSkulptor code should work on the desktop.

Respondido el 11 de junio de 13 a las 09:06

Note that SimpleGUITk installs pygame. Pygame is not supported for Python 3.3. I recommend that you use Python 2.7.x (2.7.5). - Puñal

But In my case its not supporting images and sound.......what should i do to run my Asteroid program in terminal? - Abhinay

Puedes usar mi

enter image description here SimpleGUICS2Pygame paquete.

Objectively, this is the best solution :-)

The package implement simplegui, codeskulptor, numérico y simpleplot módulos.

If your Python tools are up to date, it is easy to install:

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

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 y in standard Python (2 y 3) with this package.

Tenga en cuenta que:

  • SimpleGUITk es un otros 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 otra cosa.

Respondido 18 Abr '20, 21:04

Works fine. I tried to write a script for the solution from shuvrow. But, on my Ubuntu 13.10 I always got an error by running python game.py: raise IOError("decoder %s not available" % decoder_name) After trying everything I switched to your solution, which is perfect. Good save me couple hours of my life taking your solution straight away. - tesorero

I'm trying to install your package in Ubuntu. I've installed pip, but on running the command >>> pip install SimpleGUICS2Pygame, I get this error- error: could not create '/usr/local/lib/python2.7/dist-packages/SimpleGUICS2Pygame': Permission denied. Any help on what's going wrong? - manish giri

@Manish, you must use admin access. Try sudo [your command] - Olivier Pirson

Had already tried that. Got a bunch of error messages. Last two were: x86_64-linux-gnu-gcc: error: build/temp.linux-x86_64-2.7/libImaging/BoxBlur.o: No such file or directory y error: command 'x86_64-linux-gnu-gcc' failed with exit status 1. The Pillow-Master folder is in my downloads folder. Do I need to move the pillow-master folder to somewhere else? But the installation instructions said nothing of that sort. - manish giri

@Manish, SimpleGUICS2Pygame no use Pillow! - Olivier Pirson

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 aquí

respondido 03 mar '15, 08:03

I just installed simpleguitk to enable simplegui on my os. I am using linuxmint 15. Steps are:

First download simpleguitk from this link simpleguitk. In order to work with simplegui perfectly you have to install these packages

Pillow in order to use images.
Pygame for sound support
matplotlib for SimplePlot support.

  1. You can install Pygame by suing this command :

     sudo apt-get install python-pygame
    
  2. You can install matplotlib by using this command :

    sudo apt-get install python-matplotlib
    
  3. To install Pillow , download zip file from this link Almohada

    Unzip it and change directory to Pillow. Then use this command
    python setup.py install (assuming you've already installed python.h or you can install it using

    sudo apt-get install python.h
    
  4. Finally you have to install simpleguitk . Before installing it i suggest you to install this module setuptools.

    you can install setuptools using this command :

    sudo apt-get install python-setuptools
    

    Now Extract simpleguitk on your home directory. Then change directory to simpleguitk folder.

    After that use this command :

    python setup.py install
    

Tipo python en la terminal

Import simpleguitk as simplegui

Respondido 25 Oct 13, 15:10

SimpleGUITk can be used in Python 3.

The Problem is simplegui.py

Just install SimpleGUITk as described in the README of the package.

Then modify the simplegui.py file in the python33 folder with an text-editor.

In the file are some calls for Tkinter. Just replace Tkinter with tkinter and everything is fine and the example in the readme runs without errors.

(I also make a Coursera course. But the SimpleGUI module is not the simplegui used in CodeSkulptor. Sorry, so you can't write programs for CodeSkulptor in IDLE with this lib)

respondido 03 mar '15, 08:03

Note: Steps is for windows

The replacement for simplegui is SimpleGUICS2Pygame.

Steps to install: -
Step 1: Install Python 2.7 and Simpleguics2Pygame from : https://pypi.python.org/packages/source/S/SimpleGUICS2Pygame/SimpleGUICS2Pygame-01.08.00.tar.gz#md5=e4a18fe83e4a64c6222bfb71349be31e
Step 2: Extract it to a location (Lets call it somewhere)
Step 3: Open command prompt as administrator and change directory using the command
cd somewhere/SimpleGUICS2Pygame-01.08.00.
Step 4: Run the command setup.py install

SimpleGUICS2Pygame is now installed and can now be accessed using the following code instead of import simplegui:

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

Respondido el 20 de junio de 20 a las 10:06

The install via pip does not seem sufficient. I got pygame and matplotlib to install fine via pip on windows, but i still got error during import on SimpleGUICS2Pygame.simpleguics2pygame. I had to use the source and import the actual source file - paolov

I don't see any information on PyPI about which versions of Python simpleGUI supports. You can just try running it with Python 3 and see what happens. If it doesn't work, try using the 2to3 tools: http://docs.python.org/2/library/2to3.html

Note that simpleGUI is based on Tkinter. I would recommend learning a full GUI toolkit like Tkinter, wxPython or PySide rather than a derivative.

contestado el 06 de mayo de 13 a las 14:05

SimpleGUI is no based on Tkinter. It is a specific CodeSkulptor module written in JavaScript. The Tkinter version is SimpleGUITk. - Olivier Pirson

@OPi According to pypi.python.org/pypi/simplegui/0.1.1, "simplegui is a simplified GUI generator using Tkinter". There is pypi.python.org/pypi/SimpleGUITk/1.1.3, which I guess is what you are referring to. - mike driscoll

Oh! Yes, OK Mike. Note that this simplegui module no tiene nada que ver con the SimpleGUI of CodeSkulptor (and with SimpleGUITk and SimpleGUICS2Pygame). - Olivier Pirson

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.