Closed clementcz closed 4 years ago
It's supposed to be an infinite loop. It's just a code snippet illustrating one use of gp_camera_wait_for_event
. It should report the file captured each time the user triggers the camera, e.g. by manually pressing the shutter release.
Oh yeah, I understand.
But if it's implemented inside a code after 'gp.GP_CAPTURE_IMAGE', the code doesn't stop.
I found the condition above, but I don't know if it's the good way to stop the infinite loop.
A simple break
instruction is a more obvious way to exit a loop.
Hi,
I've just tested your example code "wait-for-event.py".
about this line :
event_type, event_data = gp.check_result( gp.gp_camera_wait_for_event(camera, timeout))
I can be work well if the camera is defined on "raw+jpg", but it's not working if the camera is defined on jpg only (or raw only). At this stage there will be an infinite loop.
I found, if we insert this inside the while, it works better:
if event_type == 1 and event_data == None: self.flag = False #to exit while loop
I don't know if it's the best solution, but it works.