From 62d7913f85de2b092a301a7fd1376c83dde352d6 Mon Sep 17 00:00:00 2001 From: Guillaume Dott Date: Fri, 29 Sep 2017 11:47:32 +0200 Subject: [PATCH] Limit refresh rate to 60 FPS --- photoboite.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/photoboite.py b/photoboite.py index 5d7fb9d..b03a8a2 100755 --- a/photoboite.py +++ b/photoboite.py @@ -59,6 +59,7 @@ class CaptureButton(Button): screen.blit(ren, topleft) def run(self): + print(self.photoboite.clock.get_fps()) pygame.event.set_blocked((pygame.MOUSEBUTTONDOWN, pygame.MOUSEBUTTONUP)) self.capture_mode = True @@ -148,6 +149,8 @@ class Photoboite: self.font = pygame.font.Font(pygame.font.match_font('calibri'), 180) + self.clock = pygame.time.Clock() + def screen(self): if os.getenv('DISPLAY'): @@ -174,6 +177,8 @@ class Photoboite: return pygame.display.set_mode() def draw(self): + self.clock.tick(60) + self.screen.fill(self.background) self.camera.draw_on(self.screen)