• obtom

    @ccc Thanks ccc. A bit embarrassing but I'd left in the console alert on my script and that seems to prevent the webview from updating even after you acknowledge the alert. Without it, it works for me too.

    posted in Pythonista read more
  • obtom


    I'm fairly new to Pythonista development and was struggling to get the contents of a webview to change when I click a button in my script.

    The script has a UI, on which I've dropped a button and a webview. I've wired the button event to 'ButtonClick' (below), and I know this gets called as I've tested it with a console alert. I've tried alternatives such as referring to the original webview instance and also via the sender superview.

    What I'm seeing is that the webview gets updated initially, but never seems to show the effect of the new contents in the button click ('my second heading'). What am I doing wrong?



    import ui
    import tempfile
    import os
    import console
    def ButtonClick(sender):    
        v1 = sender.superview
        w.load_html('<!DOCTYPE html><html><body><h1>My Second Heading</h1></html>')
    v = ui.load_view('Test')
    w.load_html('<!DOCTYPE html><html><body><h1>My First Heading</h1></html>')

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!