Limit refresh rate to 60 FPS

master
Guillaume Dott 2017-09-29 11:47:32 +02:00
parent 3b1967db22
commit 62d7913f85
1 changed files with 5 additions and 0 deletions

View File

@ -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)