I followed a tutorial, and tried to make the program quit when I press q, but that doesn't work, it quits no matter which key I press, that's the code:
twi = cv2.imread('large.png')
cv2.namedWindow('image', cv2.WINDOW_NORMAL)
cv2.imshow('image', twi)
key = cv2.waitKey(0)
if key == ord('q'):
cv2.destroyAllWindows()
And I've tried to add &0xFF:
key = cv2.waitKey(0)&0xFF
Still not working, what is wrong with it? Can I fix it?
=============Update============
I added print(key) to that, when pressing q, variable key is 113, and ord('q') is 113 either, can't understand why it doesn't work...
=============Solved=============
(Seems that I forget how if works...)