Skip to content
← Back to Community
PySimpleGUI Adds Support For Repl.it
Profile icon
h
has Hacker Plan
amasad

PySimpleGUI, the simplest cross-platform Python GUI framework just added support for Repl.it (web in general) and it's the simplest way I've seen UI being done on Repl.it yet.

This file cannot be displayed: https://storage.googleapis.com/replit/images/1548743581870_2040a56b3c7ca4c642ccd97e9a4df3d1.gi

It has good autocompletion and it's well-documented. It's especially great for new coders that want to try their hands at coding GUI.

To get started simply import the library, create a window, and give it a layout! Here is a name reading app and repl:

import PySimpleGUIWeb as sg window = sg.Window('hello world').Layout([ [sg.Text('hello world')], [sg.InputText('enter name')], [sg.Submit(), sg.Cancel()] ]) [button, [name]] = window.Read() if button == 'Submit': print('Hello ' + name)

https://repl.it/@amasad/PySimpleGUI

Voters
Profile icon
cdCreepArghhh
Profile icon
Blink
Profile icon
dotcomboom
Profile icon
PySimpleGUI
Profile icon
Benny_3
Profile icon
CaydenGietzen
Profile icon
Mosrod
Profile icon
timmy_i_chen
Profile icon
mat1
Comments
hotnewtop
Profile icon
PaoloAmoroso

That's beyond awesome. Thanks!

Profile icon
PaoloAmoroso

I've looked into PySimpleGUI a bit more and I love it. The library is simple to use but provides lots of features for more advanced needs, the documentation is excellent, and the developer is active and enthusiastic.

REMI, the foundation of PySimpleGUIWeb, is amazing too. I hope it soon adds more advanced PySimpleGUI features such as the elements required for supporting Matplotlib, which is already accessble from PySimpleGUI.

Huge thanks to MikeB, the REMI folks, and Repl.It. It's mind-blowing what can be done in the cloud.

Profile icon
KatherineAlp

I might be kinda stupid as a beginner but can someone explain to me how this works?

Profile icon
HarperframeInc

repl.it is featured in PySimpleGUI
https://pysimplegui.readthedocs.io/

Profile icon
glench

@amasad When I try to use this repl I keep getting what looks like a loading screen whenever I do something. Can't actually try the app:

This file cannot be displayed: https://storage.googleapis.com/replit/images/1548799291030_eecbcbdef456a7d62d578c429971a2d1.pn

Profile icon
amasad

@glench the problem with REMI is that by default it's not shared instance across all users. There's, however, a way to make it multi instance. I'll ask the PySimpleGUI folks to make it multi instance.

For now, fork it.

Profile icon
glench

@amasad Same thing seems to happen even after I fork it. In Chrome it reloads slowly, and in Safari it just keeps reloading continuously:

This file cannot be displayed: https://storage.googleapis.com/replit/images/1548878128321_285a934eb5ea382ac8a3a9200aea6a2e.pn

Profile icon
DavideRosa

@glench possible causes:

  • slow internet connection
  • old browser
  • cookies disabled
Profile icon
glench

@DavideRosa oh huh! I have the most recent Chrome (beta) and Safari and my internet is fast. In Chrome I have 3rd party cookies disabled and in Safari I have what looks like default setting of cookies enabled from websites I visit.

Profile icon
DavideRosa
Profile icon
glench

@DavideRosa Works fine in Safari and Chrome (although video won't play probably due to 3rd-party cookies being disabled).

However, when I go to http://remiexample--daviderosa.repl.co/__repl it works in Safari but then fails when I tried to fork it. In Chrome when I go to the __repl url it fails both viewing your project and forking my own version.

Profile icon
DavideRosa

@glench I don't know what does __repl appended at the end of the url. however I will give you some more info tomorrow, now it's late night here ;-)

Profile icon
DavideRosa

@glench avoid to use __repl url since it tries to make http request to the same server, but from a different url, and this is not allowed. fork it access the standard url . Consider also that there is a graphical gui editor http://remiguieditor--daviderosa.repl.co/ .

Profile icon
glench

@DavideRosa I mean, I wanted to use the __repl to see and modify the source. Even when I forked it it didn't work :(

Profile icon
DavideRosa

@glench I opened your fork and it works. It starts at this address "https://remiexample-1.glench.repl.run" and from here we can se the console output. then if I change the url to "https://remiexample-1.glench.repl.co" I can see the UI page correctly.

Profile icon
glench

@DavideRosa Yeah, but it doesn't work in the repl.it IDE/editor, which is the bug I'm reporting.

Profile icon
PySimpleGUI

@amasad

I've added an option to the Window call in PySimpleGUI to turn on / off the multi-instance option. I tried setting it to ON as a default and it REALLY struggled on repl.it.
So, in version 0.15.0, I turned it back off again, but left the option for others to turn it on.

Profile icon
amasad

@PySimpleGUI thanks. Can you tell me a bit about the struggle? Maybe we can fix ir

Profile icon
PySimpleGUI

@amasad You can try this program
https://repl.it/@PySimpleGUI/timerpy
to see the difference in the setting. I was unable to change the behavior now that I've tried again.

The setting to modify is on line 14:
web_multiple_instance=False

This changes the Remi multiple_instance setting which someone suggested as a fix to a problem. I find regardless of the setting, if I open 2 repl.it copies, in 2 different browsers, they sync up and show identical things. When one pauses, so does the other.

Profile icon
amasad

@PySimpleGUI That's because Remi relies on browser cookies. Try incognito window or a seperate browser.

Profile icon
bhugh

@glench @amasad @DavideRosa When you fork, for some reason the web browser pane is still connected to the original repl.it rather than the new fork. Thus the problems.

If you reload the entire browser with the URL for the new fork, then the browser pane updates to the new fork and all is well.

Profile icon
bhugh

@amasad @PySimpleGUI @DavideRosa Remi & PySimpleGUIWeb can run independent sessions using the same URL but each session needs a different port.

On my machine at home this technique actually works quite well but when I tried it on repl.it I discovered that repl.it intercepts the port requested and replaces it (usually with port 80 or 443 it looks like).

So I don't know if that is an easy thing or a near-impossible thing under repl.it, but if you could allow different ports to be used, then it would allow multiple users per repl in these situations instance.

Partly what I'm thinking of here is easy of use for certain potentially nice online apps. Technical people are going to have no problem with "fork it, then reload the page" but if the average joe can just go to a page and start clicking it usually works better for them.