Kivy - check if popup is currently showing (because Kivy Popup isn't really modal (back button/keyboard))
<p>I bind to Window.on_key_down in my root widget to handle android's back button.</p>
<p>ModalView (and it's child Popup) are not REALLY modal, they don't handle the keyboard at all, hence the back button is also not handled.</p>
<p>If I inherit from Popup and do a bind to Window.on_key_down which returns True, then I can handle the back button from within my inheriting class. At this point I can either unbind in on_dismiss or delete the widget (can't seem to get deletion to work reliably, but that's not a separate question).</p>
<p>The problem is that this partitions out my handling of the back button across all my screens (I use a screen manager) rather than in my root widget. So I'm looking for a way to check, from my root widget, if ANY popups are currently open (preferably without iterating through the widget tree as won't scale too well). Please advise on the options I'm thinking off below as well as any other suggestions:-</p>
<h1>Option 1</h1>
<p>One single popup widget initialized in the root widget, which all screens will modify/open() when necessary. This would necessitate binding/unbinding the buttons of that popup, of course. The root widget can then easily check this single object to see if its open or not.</p>
<h1>Option 2</h1>
<p>Handle keyboard in a class inheriting from popup widget, and unbind the keyboard at the end. Problem of splitting back button handling to many files/screens, and building up of old popup widgets over long use of the app.</p>
<h1>Option 3</h1>
<p>???</p>