Forum Archive

Screen auto-lock

krizex

I have a game in which everything is controlled by gravity(). So after a while the device decides that nothing happens and the screen goes blank. Is there a way to avoid this? (without changing device auto-locking time settings)

omz

Yes, you can add console.set_idle_timer_disabled(True) to your setup method to turn off auto-locking when your game starts.

You should also add a stop method to your scene (if you haven't already), and go back to the normal behavior there:

class MyScene (Scene):
    # ...
    def stop(self):
        # Note: This will be called automatically when the scene is closed.
        console.set_idle_timer_disabled(False)