• mithrendal

    SOLVED
    I tried a mix of both suggestions with the global variable and the instance and onscreen test. But when I launch the app the second time then the global var is empty.
    Now I did the trick with the bultins class. That works fine and solves the issue nicely . Thank you so much.

    Here is the code
    import builtins

    if name == 'main':

    try:
        v=builtins.theview
    except:
        v=None
        
    if(isinstance(v,ui.View) and v.on_screen ):
        #console.hud_alert('reuse view')
    else:
        #console.hud_alert('create view')
        v = ui.load_view()
        v.present('sheet')
        builtins.theview=v

    posted in Pythonista read more
  • mithrendal

    I like to know that too. Whenever I launch my ui.View app for example via url schema and it was already running then i have two views stacked on each other. I followed two approaches to solve.

    1. I start a thread and checking every second wether the app is in background. If so then I close the view. This is working but of course with the disadvantage that the view also closes when leaving pythonista for something other then restarting the script a second time.

    2. On start of my script I would try two identify all current views and close them before presenting the new view. But I did not succeed to address e.g. find the views.

    posted in Pythonista read more
  • mithrendal

    I like this too. 🤗

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!