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.
Override Scene exit button
-
I wrote a party game using the Scene module that involves passing my phone around a lot. Someone inevitably pushes the corner 'X', which quits the game early. I haven't been able to see where to change this behavior. Much of the scene code is hidden in the _scene module. Any suggestions? I'm fine with having no exit for the game (force close the whole app to quit).
-
import scene, ui class UnclosableScene(ui.View): def __init__(self, the_scene): scene_view = scene.SceneView() scene_view.scene = the_scene self.present(hide_title_bar=True) scene_view.frame = self.bounds self.add_subview(scene_view) class BlueScene(scene.Scene): def __init__(self): self.background_color = 'midnightblue' UnclosableScene(BlueScene())
A two fingered swipe down will shutdown the scene.
-
Thanks! I'll experiment with this and try to integrate it with my existing code.
-
Clever solution, @ccc
-
This worked great! Just one more question - I haven't worked with Pythonista's ui before, how do I keep the view from rotating? I'd like to keep it fixed in landscape.
Nevermind - I added 'orientation = ['landscape]' as an argument to 'self.present'. Problem solved.