Is there a function or action I can refer to when a view is closed after view.present()?
I want to call a function when closed. In my case, I close the view with the left blue X in the title bar.
I was quite certain that there was a
View.will_closemethod, but I can't find it in the docs. Maybe I'm imagining things. Other solutions could be
View.wait_modal()(which blocks execution and returns once the view is no longer visible) or adding a custom close button that calls
View.close()and then runs the "cleanup" code.
will_closedoes work, but you have to make a custom View class.
https://github.com/671620616/PhantomChess/blob/master/Phantom/gui_pythonista/game_view.pywhich creates a custom close
Xto allow you to hide the title bar to maximize screen real estate for your content.