我正在Python 3.5中使用多进程。
#Multiprocessing
def main():
p1 = multiprocessing.Process(name="p1", target=datac)
p2 = multiprocessing.Process(name="p2", target=test)
p2.start()
p1.start()
if __name__ == "__main__":
main()
有两个过程=>
1.测试
2.datac
测试:
def test():
#a=0
while 1:
#if 'gaze_point' in gaze_data_callback(gaze_data):
# data = gaze_data_callback['gaze_point']
# if s == 0:
# x = data[0] * 1920
# y = data[1] * 1080
# return [x, y]
#a+=1
for x in range(0, 10):
print("We're on time %d" % (x))
print('Waiting..')
#time.sleep(5)
Datac:
def datac():
while 1:
tmp = eye.__new__(eye)
tmp.__init__()
print(tmp)
这是课程:
class eye(object):
def gaze_data_callback(gaze_data):
left_3d = gaze_data['left_gaze_point_in_user_coordinate_system']
right_3d = gaze_data['right_gaze_point_in_user_coordinate_system']
#Get the gaze point of both eyes
gaze_point = ((left_3d), (right_3d))
gaze_point = tuple(mean(gaze_point, axis=0))
print("3d gaze:",gaze_point)
my_eyetracker.subscribe_to(tr.EYETRACKER_GAZE_DATA, gaze_data_callback, as_dictionary=True)
time.sleep(5)
my_eyetracker.unsubscribe_from(tr.EYETRACKER_GAZE_DATA, gaze_data_callback)
return (gaze_point)
我想打印凝视点,但是没有被打印。我正在获取对象位置