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.
Can a script interact with the X button?
-
Greetings to the Pythonista community.
I just bought the app and have been playing around with it, with the intention of making a small game for starters (it's now my favorite app by far btw). One topic I have been searching for that I have not been able to find any information on is how to have your script interact with the X button at the top of the screen (the one that shows while running the script). Is this possible? I read the thread on hiding the X button, but that is all I could find on it.For example, I added a song to the included game tutorial (with the alien and falling rocks). I set it to loop, and when I stop the script using the X button, the song continues to play. I have to close out of the app to get it to stop looping. Is there a way that I can make Player.stop() react to when I tap the X button so that the song stops playing when I stop the script?
I will appreciate any help with this, and I am excited to learn more about Python and Pythonista!
-
In the Game class you can include a
def stop(self):
...
method. It gets called automatically when a scene is stopped (by tapping the “x” button). -
Thank you so much! That is exactly what I was looking for.