Again, @cvp, thanks a lot for the code. Using the GUI is problematic since much of what I do involves grabbing data from a server, doing something with it, then calling another app using web browser.open(url). When that is done within a Pythonista GUI script, it leaves the GUI window running in Pythonista. My flow is like this:
- Run a shortcut from the Shortcuts app.
- Shortcut calls a Pythonista script.
- Pythonista script makes a remote server call to get data, perhaps display it, perhaps copy to clipboard.
- Pythonista script calls another app using web browser.open(url)
- Other app opens and I do some stuff.
I consider this operation done, but Pythonista still has the GUI on screen if you enter the Pythonista App. So, when I do this same operation again, and the shortcut calls Pythonista, I now have two GUI windows stacked in Pythonista. This does work, but it seems clumsy and fraught with unknown problems.
So, when I have a process like this, I have been making do with the dialogs module in Pythonista, which doesn't have this problem--but has other limitations.