omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    PySimpleGUI wrapper for Pythonista...?

    Pythonista
    8
    17
    1673
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Niall
      Niall last edited by

      Hi,

      I teach programming and I'm now using PySimpleGUI in my courses. The university only officially supports CPython on desktop and Anaconda/Jupyter; however, I'd be happy for students to use an iPad if they've got one (and a keyboard) but only if they can use the right libraries!!

      If you're not familiar with PySimpleGUI, it's a fairly basic but robust cross-platform standard that is implemented as a wrapper for all the main Python GUI libraries -- TkInter, Qt, WxWidgets, Remi (web browser as GUI). You'll clearly get different visual results on each, but the functionality will be almost identical on each.

      To me, a Pythonista wrapper (PySimpleGUIPythonista or similar) would make perfect sense, as it would give us a way of making cross-platform GUIs on our iPads and would mean a lot more Python apps would work on Pythonista.

      1 Reply Last reply Reply Quote 0
      • Niall
        Niall last edited by

        (Did have a wee nosey at Toga, as I see Pyto does that, but it's more complicated than I want for a course where GUI dev is a side-effect of the content, not the main goal. Also, there seem to be serious dependency problems installing Toga on Windows when it comes to Python versions, and that's a hell of lot of discouraging boilerplate for absolute newbies...)

        1 Reply Last reply Reply Quote 0
        • mehmetsal
          mehmetsal last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • mikael
            mikael last edited by

            While it would be an intriguing and feasible project to wrap the Pythonista UI components in PySimpleGUI, it would still not be trivial, and I am afraid the results might not meet the needs of most user groups.

            For students, taking a course exercise and trying to run it on Pythonista could very easily fail due to unsupported syntax, given that Pythonista runs the now-unsupported Python 3.6.

            For Pythonista users, given that a lot of the power of Pythonista is in its access to iPhone-native functionality, it is very unlikely that an existing significant piece of code would run anywhere else.

            Thinking of your requirements, if PySimpleGUI really runs reliably on the web, the students with iPads could maybe use repl.it to run the code, sync code with GitHub, and do the editing on Pythonista.

            You probably already have all the materials built around PySimpleGUI. Otherwise I would suggest you to take a look at flet, which has the benefit of running a native or web Flutter app without additional platform-specific wrappers.

            1 Reply Last reply Reply Quote 1
            • Niall
              Niall last edited by Niall

              Well, I'm teaching an introductory course and need to teach a "lowest common denominator" version that will work for various different courses with different needs.
              Between the various IDEs and Python installs, the lowest I've found is WinPython 3.7, and the only potentially significant difference between that and 3.6 for a beginner's level course is the ordering of dictionary keys.

              "For Pythonista users, given that a lot of the power of Pythonista is in its access to iPhone-native functionality, it is very unlikely that an existing significant piece of code would run anywhere else."
              The reason I never became a heavy Pythonista user myself was the lack of portability. I would have done a lot more dev work on the iPad if I wasn't damning myself to forking stuff.

              1 Reply Last reply Reply Quote 0
              • Niall
                Niall last edited by

                (I love the idea of sitting on a beach coding, but even if it had the battery life for it, my laptop's staying off the beach. I've still go a first-gen iPad mini, which I consider practically disposable at this point!!!)

                R 1 Reply Last reply Reply Quote 0
                • Ryan_Bray
                  Ryan_Bray last edited by Ryan_Bray

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • Niall
                    Niall last edited by

                    Just curious as to whether anyone has looked at this at all? I'm kind of contemplating seeing if I can get a minimal version of this going to let my students use Pythonista next year....

                    1 Reply Last reply Reply Quote 0
                    • upwart
                      upwart last edited by

                      It would indeed be nice, if we had PySimpleGUI basic functionality (what is that?) in Pythonista. But, that would be quite a job, although not impossible.
                      BTW, Although PySimpleGUI claims to be cross-GUI, in fact it only runs properly under tkinter. So, if we would have tkinter at our disposal under Pythonista, we could run PySimpleGUI as well. But, it's quite unlikely that we will ever see tkinter running under Pythonista or on an iPad in general (unless we get full Linux one day). Just dreaming ....

                      Niall 1 Reply Last reply Reply Quote 0
                      • Niall
                        Niall @upwart last edited by

                        @upwart Well I do kind of think they've potentially overcomplicated PySimpleGUI and I personally try not to use the full functionality. I think I tended to test by switching between the basic library (TkInter) and the other major ones (Qt, Wx, Web) to make sure I was using the most interoperable version. I found the Qt tended to be best anyway, and the very basic idea of having the interface defined as a list of rows where each row is a list of columns gets rid of a lot of need for thinking... as long as you don't need a "table" type view.

                        My thinking is that in my own masters, I could have benefited from a GUI that was easy to write but hard to make "nice and shiny", cos I would be able to put up with a scrappy-looking interface that matched my thinking, but couldn't see the point in learning fiddly GUI libraries to get the same result. I reckon a lot of my postgrads would fall into the same bracket.

                        JonB 1 Reply Last reply Reply Quote 0
                        • JonB
                          JonB @Niall last edited by

                          @Niall ok, I haven't tried yet, but I can't think of a reason why the web version wouldn't work on pythonista. You'd need to launch a webView for display, but it looks like remi is pure python, and pysimpleguiweb ought to work.

                          Niall 1 Reply Last reply Reply Quote 0
                          • P
                            Paidhours last edited by Paidhours

                            If you're looking for accurate and up-to-date information about NHS hourly pay rates, look no further than the NHS Hourly Pay Band Table provided onband 5 hourly rate

                            1 Reply Last reply Reply Quote 0
                            • Niall
                              Niall @JonB last edited by

                              OK, finally got round to working out how to install additional packages (lack of pip solved by installing StaSh)>

                              Unfortunately the syntax of PySimpleGUIWeb doesn't seem to agree with Pythonista. There are a couple of lines in PySimpleGUIWeb.py saying "if image_size is not (null, null)" that raise a warning "SyntaxWarning: "is not" with a literal, Did you mean "!="?"

                              I can completely see the logic of that, as I realise the common error of mixing up == with is... all I'm confused about is whether this was something that the PySimpleGUI guys did with a Python 2 target in mind, cos I know that Python 3 cleared up is/is not handling quite a bit.

                              But that's a warning... the real error that stops it is a popup window overlay
                              "
                              Attribute error
                              'HTMLParser' object has no attribute 'unescape'
                              "

                              (I'm basically only commenting to document my thinking. Will genuinely consider making a very basic copy of the main GUI functionality now from Pythonista UI stuff.)

                              JonB 2 Replies Last reply Reply Quote 0
                              • JonB
                                JonB @Niall last edited by

                                @Niall that is just a warning. See https://github.com/PySimpleGUI/PySimpleGUI/issues/3663
                                Don't know why they never fixed that, but probably doesn't affect things. .. it should probably be something like

                                if (image_size[0] is not None) or (image_size[1] is not None)
                                

                                But I'm not sure. Since they never bothered fixing it, I'm guessing it isn't causing issues.

                                JonB 1 Reply Last reply Reply Quote 0
                                • JonB
                                  JonB @JonB last edited by

                                  can you post the full traceback?

                                  1 Reply Last reply Reply Quote 0
                                  • JonB
                                    JonB @Niall last edited by JonB

                                    @Niall looks like they haven't upgraded to python 3.9 yet.

                                    Replace the falls to unescape from HTMLParser objects with

                                    import html
                                    html.unescape
                                    

                                    See the workaround near bottom of this
                                    https://github.com/PySimpleGUI/PySimpleGUI/issues/4119

                                    You have to edit gui.py in your remi folder (site-packages/remi), and make the suggested changes.

                                    1 Reply Last reply Reply Quote 0
                                    • R
                                      ReneeColangelo @Niall last edited by

                                      @Niall I have tried those ones, and it feels good. hehe

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post
                                      Powered by NodeBB Forums | Contributors