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.
Any way to hook into the Close Button of a Share extension?
-
With the help of the generous advice of the people on this forum I have written a image extension. So far, so good, so happy.
Let's look at the work flow: Say, in the Files app I have selected some images, then go to Share --> Pyhonista --> My Script and then the Image UI opens:
Now when I decide I want close the UI I do this via the Close button (circled in the screenshot). However the Pyhonista script selector stays visible then. Programmatically I know I can dismiss it with
appex.finish()
, but how can I hook this call up to the Close button?Any idea?
-
@halloleooo so easy 😀 (or I didn't understand the question)
import ui import appex class MyView(ui.View): def __init__(self): pass def will_close(self): appex.finish() def main(): v = MyView() v.present() if __name__ == '__main__': main()
-
@halloleooo is it ok?
-
Thanks @cvp. Works a treat! That's exactly what I want.
I wasn't aware of
will_close
but, of course, I found it now in the doco.