• mikael

    @ZinoSama, if you want to do a lot of little animations, you could take a look at scripter (blows dust off the link). With it, you can have several simultaneous and long-running animations without having to worry about the UI thread.

    An example of a button click handler running a counter to 100:

    @script
    def start(sender):
        label = sender.superview["label1"]
        set_value(label, "text", range(1, 101), lambda count: f"Count: {count}")
    

    posted in Pythonista read more
  • mikael

    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.

    posted in Pythonista read more
  • mikael

    @cvp, have been following along again now that the update emails work again. Thank you, or anyone else who might have made that happen.

    posted in Pythonista read more
  • mikael

    And if you just need the text directly:

    from bs4 import BeautifulSoup
    
    html = '''
    <!doctype html>
    <html>
        <head>
            <meta charset="utf-8">
            <title>Title</title>
        <style type="text/css">
        /* CSS styles here... */
        </style>
        </head>
        
        <body>
        
        <h1>Hello</h1>
        
        </body>
        
    </html>
    '''
    
    soup = BeautifulSoup(html, "html5lib")
    
    # Strip empty lines and extra white space
    text = '\n'.join(
        line.strip() for line in soup.text.splitlines()
        if line.strip()
    )
    
    print(text)
    

    There’s also a library you could install to get a nicer text representation as markdown, where h1 titles are underlined etc.

    posted in Pythonista read more
  • mikael

    @cvp, thanks! Have been hacking more on the laptop lately.

    posted in Pythonista read more
  • mikael

    @rb, if we are talking something like a photo with rectangles, you could also use the iOS Vision framework, see here.

    I have a Python implementation lying around somewhere, let me know if that seems interesting.

    posted in Pythonista read more
  • mikael

    @rb, are the rectangles exactly "squared" or can they be in any position in the image? Are the rectangles solid colour and the background another colour, or is the background (say) white with (say) black rectangular outlines? Do you know what the colours are or can they be anything?

    posted in Pythonista read more
  • mikael

    @cvp, impressive! Know how hard these seemingly simple things can be.

    posted in Pythonista read more
  • mikael

    @samsonantony, as one possible building block. here is ObjC code that can be used to save a video clip slowed down without audio:
    https://stackoverflow.com/questions/17296999/how-to-do-slow-motion-video-in-ios

    posted in Pythonista read more
  • mikael

    @JonB, your post should be pinned to the top of the forum, wonder if @ccc has access.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!