-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgazer_utils.py
More file actions
31 lines (22 loc) · 796 Bytes
/
gazer_utils.py
File metadata and controls
31 lines (22 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python
import pygame, os
from SimpleCV import Camera, Display
class GazerUtils:
def __init__(self):
self.fullscreen_size = None
self.title = None
def getCamera(self, properties = {"width": 1280, "height": 720}):
return Camera(prop_set=properties)
def __setupDisplayProperties(self):
# centeralize the display window
os.environ['SDL_VIDEO_CENTERED'] = '1'
# get the monitor's full screen size
pygame.init()
self.fullscreen_size = pygame.display.Info().current_w, pygame.display.Info().current_h
self.title = 'Gaze Tracker'
def getDisplay(self):
self.__setupDisplayProperties()
return Display(self.fullscreen_size, pygame.RESIZABLE, self.title)
def runningPercentage(self,success, total):
val = (1.0 * success/total) * 100.0
return round(val, 2)