(self, device=None, camres=(640,480), disptype='window', dispres=(1024,768), display=None)
Initializes a Setup instance
		
		arguments
		None
		
		keyword arguments
		device		--	a string or an integer, indicating either
						device name (e.g. '/dev/video0'), or a
						device number (e.g. 0); None can be passed
						too, in this case Setup will autodetect a
						useable device (default = None)
		camres		--	the resolution of the webcam, e.g.
						(640,480) (default = (640,480))
		disptype		--	a string indicating what kind of
						calibration display should be presented;
						choose from 'window' (PyGame windowed),
						'fullscreen' (PyGame fullscreen)
						(default = 'window')
		dispres		--	the resolution of the display, e.g.
						(1280,1024) (default = 1024,768)
		display		--	pass None to let the Setup create its own
						display, otherwise pass a display that
						matches the disptype you provided (under
						the disptype argument) to let the Setup use
						that display; example: set disptype to
						'fullscreen', then pass a
						pygame.surface.Surface instance that is
						returned by pygame.display.set_mode:
						calibration will then be presented on the
						passed pygame.surface.Surface instance
Initializes a Setup instance
		
		arguments
		None
		
		keyword arguments
		device		--	a string or an integer, indicating either
						device name (e.g. '/dev/video0'), or a
						device number (e.g. 0); None can be passed
						too, in this case Setup will autodetect a
						useable device (default = None)
		camres		--	the resolution of the webcam, e.g.
						(640,480) (default = (640,480))
		disptype		--	a string indicating what kind of
						calibration display should be presented;
						choose from 'window' (PyGame windowed),
						'fullscreen' (PyGame fullscreen)
						(default = 'window')
		dispres		--	the resolution of the display, e.g.
						(1280,1024) (default = 1024,768)
		display		--	pass None to let the Setup create its own
						display, otherwise pass a display that
						matches the disptype you provided (under
						the disptype argument) to let the Setup use
						that display; example: set disptype to
						'fullscreen', then pass a
						pygame.surface.Surface instance that is
						returned by pygame.display.set_mode:
						calibration will then be presented on the
						passed pygame.surface.Surface instance
Initializes a Setup instance arguments None keyword arguments device -- a string or an integer indicating either device name ( e . g . / dev / video0 ) or a device number ( e . g . 0 ) ; None can be passed too in this case Setup will autodetect a useable device ( default = None ) camres -- the resolution of the webcam e . g . ( 640 480 ) ( default = ( 640 480 )) disptype -- a string indicating what kind of calibration display should be presented ; choose from window ( PyGame windowed ) fullscreen ( PyGame fullscreen ) ( default = window ) dispres -- the resolution of the display e . g . ( 1280 1024 ) ( default = 1024 768 ) display -- pass None to let the Setup create its own display otherwise pass a display that matches the disptype you provided ( under the disptype argument ) to let the Setup use that display ; example : set disptype to fullscreen then pass a pygame . surface . Surface instance that is returned by pygame . display . set_mode : calibration will then be presented on the passed pygame . surface . Surface instance
def __init__(self, device=None, camres=(640,480), disptype='window', dispres=(1024,768), display=None):
		
		"""Initializes a Setup instance
		
		arguments
		None
		
		keyword arguments
		device		--	a string or an integer, indicating either
						device name (e.g. '/dev/video0'), or a
						device number (e.g. 0); None can be passed
						too, in this case Setup will autodetect a
						useable device (default = None)
		camres		--	the resolution of the webcam, e.g.
						(640,480) (default = (640,480))
		disptype		--	a string indicating what kind of
						calibration display should be presented;
						choose from 'window' (PyGame windowed),
						'fullscreen' (PyGame fullscreen)
						(default = 'window')
		dispres		--	the resolution of the display, e.g.
						(1280,1024) (default = 1024,768)
		display		--	pass None to let the Setup create its own
						display, otherwise pass a display that
						matches the disptype you provided (under
						the disptype argument) to let the Setup use
						that display; example: set disptype to
						'fullscreen', then pass a
						pygame.surface.Surface instance that is
						returned by pygame.display.set_mode:
						calibration will then be presented on the
						passed pygame.surface.Surface instance
		"""
		
		# DEBUG #
		if DEBUG:
			self.savefile = open('data/savefile.txt','w')
		# # # # #

		# create new Display if none was passed, or use the provided display
		if display == None:
			if disptype == 'window':
				self.disp = pygame.display.set_mode(dispres, pygame.RESIZABLE)
			elif disptype == 'fullscreen':
				self.disp = pygame.display.set_mode(dispres, pygame.FULLSCREEN|pygame.HWSURFACE|pygame.DOUBLEBUF)
			else:
				raise Exception("Error in camtracker.Setup.__init__: disptype '%s' was not recognized; please use 'window', 'fullscreen'")
		# if a display was specified, use that
		else:
			self.disp = display
			dispres = self.disp.get_size()
		
		# select a device if none was selected
		if device == None:
			available = available_devices()
			if available == []:
				raise Exception("Error in camtracker.Setup.__init__: no available camera devices found (did you forget to plug it in?)")
			else:
				device = available[0]
		
		# create new camera
		self.tracker = CamEyeTracker(device=device, camres=camres)
		
		# find font: first look in directory, if that fails we fall back to default
		try:
			fontname = os.path.join(os.path.split(os.path.abspath(__file__))[0],'resources','roboto_regular-webfont.ttf')
		except:
			fontname = pygame.font.get_default_font()
			print("WARNING: camtracker.Setup.__init__: could not find 'roboto_regular-webfont.ttf' in the resources directory!")
		# create a Font instance
		self.font = pygame.font.Font(fontname, 24)
		self.sfont = pygame.font.Font(fontname, 12)
		
		# set some properties
		self.disptype = disptype
		self.dispsize = dispres
		self.fgc = (255,255,255)
		self.bgc = (0,0,0)
		
		# fill display with background colour
		self.disp.fill(self.bgc)

		# set some more properties
		self.img = pygame.surface.Surface(self.tracker.get_size())	# empty surface, gets filled out with camera images
		self.settings = {'pupilcol':(0,0,0), \
					'threshold':100, \
					'nonthresholdcol':(100,100,255,255), \
					'pupilpos': (camres[0]/2,camres[1]/2), \
					'pupilrect':pygame.Rect(camres[0]/2-50,camres[1]/2-25,100,50), \
					'pupilbounds': [0,0,0,0], \
					'':None					
					}
def __init__ ( self , device = None , camres = ( 640 , 480 ) , disptype = 'window' , dispres = ( 1024 , 768 ) , display = None ) : # DEBUG # if DEBUG : self . savefile = open ( 'data/savefile.txt' , 'w' ) # # # # # # create new Display if none was passed, or use the provided display if display == None : if disptype == 'window' : self . disp = pygame . display . set_mode ( dispres , pygame . RESIZABLE ) elif disptype == 'fullscreen' : self . disp = pygame . display . set_mode ( dispres , pygame . FULLSCREEN | pygame . HWSURFACE | pygame . DOUBLEBUF ) else : raise Exception ( "Error in camtracker.Setup.__init__: disptype '%s' was not recognized; please use 'window', 'fullscreen'" ) # if a display was specified, use that else : self . disp = display dispres = self . disp . get_size ( ) # select a device if none was selected if device == None : available = available_devices ( ) if available == [ ] : raise Exception ( "Error in camtracker.Setup.__init__: no available camera devices found (did you forget to plug it in?)" ) else : device = available [ 0 ] # create new camera self . tracker = CamEyeTracker ( device = device , camres = camres ) # find font: first look in directory, if that fails we fall back to default try : fontname = os . path . join ( os . path . split ( os . path . abspath ( __file__ ) ) [ 0 ] , 'resources' , 'roboto_regular-webfont.ttf' ) except : fontname = pygame . font . get_default_font ( ) print ( "WARNING: camtracker.Setup.__init__: could not find 'roboto_regular-webfont.ttf' in the resources directory!" ) # create a Font instance self . font = pygame . font . Font ( fontname , 24 ) self . sfont = pygame . font . Font ( fontname , 12 ) # set some properties self . disptype = disptype self . dispsize = dispres self . fgc = ( 255 , 255 , 255 ) self . bgc = ( 0 , 0 , 0 ) # fill display with background colour self . disp . fill ( self . bgc ) # set some more properties self . img = pygame . surface . Surface ( self . tracker . get_size ( ) ) # empty surface, gets filled out with camera images self . settings = { 'pupilcol' : ( 0 , 0 , 0 ) , 'threshold' : 100 , 'nonthresholdcol' : ( 100 , 100 , 255 , 255 ) , 'pupilpos' : ( camres [ 0 ] / 2 , camres [ 1 ] / 2 ) , 'pupilrect' : pygame . Rect ( camres [ 0 ] / 2 - 50 , camres [ 1 ] / 2 - 25 , 100 , 50 ) , 'pupilbounds' : [ 0 , 0 , 0 , 0 ] , '' : None }