system/ui: Fix crash when exiting the application with CTRL+C (KeyboardInterrupt). (#35221)

handle KeyboardInterrupt
pull/35225/head
Dean Lee 1 week ago committed by GitHub
parent 64b0ede9ae
commit f1c0109c89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      system/ui/lib/application.py

@ -131,6 +131,7 @@ class GuiApplication:
rl.close_window() rl.close_window()
def render(self): def render(self):
try:
while not (self._window_close_requested or rl.window_should_close()): while not (self._window_close_requested or rl.window_should_close()):
rl.begin_drawing() rl.begin_drawing()
rl.clear_background(rl.BLACK) rl.clear_background(rl.BLACK)
@ -142,6 +143,8 @@ class GuiApplication:
rl.end_drawing() rl.end_drawing()
self._monitor_fps() self._monitor_fps()
except KeyboardInterrupt:
pass
def font(self, font_weight: FontWeight=FontWeight.NORMAL): def font(self, font_weight: FontWeight=FontWeight.NORMAL):
return self._fonts[font_weight] return self._fonts[font_weight]

Loading…
Cancel
Save