我想通过单击窗口右上角的关闭按钮来关闭我的OpenCV窗口。希望你能理解这张照片
这是我编写的代码
import cv2
import numpy as np
import pyzbar.pyzbar as pyzbar
cap = cv2.VideoCapture(0)
font = cv2.FONT_HERSHEY_PLAIN
while True:
_, frame = cap.read()
decodedObjects = pyzbar.decode(frame)
for obj in decodedObjects:
print("Data", obj.data)
cv2.putText(frame, str(obj.data), (60, 60),font,3,(255,0,0), 3)
cv2.imshow("Frame", frame)
key = cv2.waitKey(1)
if key == 27:
cv2.destroyWindow("Frame")
break
请帮助我