PySimpleGUI Adds Support For Repl.it
amasad (1501)

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.

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

You are viewing a single comment. View All
glench (36)

@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:

amasad (1501)

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

glench (36)

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

DavideRosa (29)

@glench possible causes:

  • slow internet connection
  • old browser
  • cookies disabled
glench (36)

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

glench (36)

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

DavideRosa (29)

@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 ;-)

DavideRosa (29)

@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/ .

glench (36)

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

DavideRosa (29)

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

glench (36)

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

PySimpleGUI (10)

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

amasad (1501)

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

PySimpleGUI (10)

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

amasad (1501)

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

bhugh (0)

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

bhugh (0)

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