python - openCV closing a window with a mouse click on a Raspberry Pi -
you think asking world, want have user click close x in opencv window , have program recognise it.
it seems not easy, , after 4 days of going round in circles , finding out how can done on windows machine no closer finding out how on raspberry pi using python.
i think need handle of opencv window ( how? ) , use see if window still visible ( call? ) , if not, bring proceedings halt ( can bit ).
i have tried cvgetwindowhandle("window_name") i've downloaded source , getwindowhandle doesn't seem available python.
the code capture left button mouse click event , close window simple:
if event == cv2.event_lbuttondown: cv2.destroywindow("window_name") there tutorial on how use button click event here took code, provides full working example in python.
however running unix based system on rpi , therefore want read this answer made need combination of waitkey(1) in order work.
Comments
Post a Comment