Skip to content

Commit

Permalink
Exiting the app
Browse files Browse the repository at this point in the history
  • Loading branch information
hughrawlinson committed Jun 1, 2024
1 parent 5cf9036 commit 8ff5c2c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
from app import App
from app_components import clear_background
from power import BatteryLevel
from events.input import Buttons, BUTTON_TYPES

class Battery(App):
def __init__(self):
pass
self.button_states = Buttons(self)

def update(self, delta):
pass
def update(self, delta):if self.button_states.get(BUTTON_TYPES["CANCEL"]):
# The button_states do not update while you are in the background.
# Calling clear() ensures the next time you open the app, it stays open.
# Without it the app would close again immediately.
self.button_states.clear()
self.minimise()

def draw(self, ctx):
ctx.save()
Expand Down

0 comments on commit 8ff5c2c

Please sign in to comment.