5 import tobii_research
as tr
8 def call_eyetracker_manager_example():
10 os_type = platform.system()
13 if os_type ==
"Windows":
14 ETM_PATH = glob.glob(os.environ[
"LocalAppData"] +
15 "/TobiiProEyeTrackerManager/app-*/TobiiProEyeTrackerManager.exe")[0]
16 DEVICE_ADDRESS =
"tobii-ttp://IS404-100107417574" 17 elif os_type ==
"Linux":
18 ETM_PATH =
"TobiiProEyeTrackerManager" 19 DEVICE_ADDRESS =
"tobii-ttp://TOBII-IS404-100107417574" 20 elif os_type ==
"Darwin":
21 ETM_PATH =
"/Applications/TobiiProEyeTrackerManager.app/Contents/MacOS/TobiiProEyeTrackerManager" 22 DEVICE_ADDRESS =
"tobii-ttp://TOBII-IS404-100107417574" 24 print(
"Unsupported...")
27 eyetracker = tr.EyeTracker(DEVICE_ADDRESS)
31 etm_p = subprocess.Popen([ETM_PATH,
32 "--device-address=" + eyetracker.address,
34 stdout=subprocess.PIPE,
35 stderr=subprocess.PIPE,
38 stdout, stderr = etm_p.communicate()
40 if etm_p.returncode == 0:
41 print(
"Eye Tracker Manager was called successfully!")
43 print(
"Eye Tracker Manager call returned the error code: " + str(etm_p.returncode))
45 if os_type ==
"Windows":
50 for line
in errlog.splitlines():
51 if line.startswith(
"ETM Error:"):
54 except Exception
as e:
58 if __name__ ==
"__main__":
59 call_eyetracker_manager_example()