How change the 'q' to call my button i create
How change the 'q' to call my button i create
import cv2
from tkinter import *
root = Tk()
# 1.creating a video object
video = cv2.VideoCapture(0)
# 2. Variable
a = 0
# 3. While loop
button1= Button(root, text="Take a picture", height= 5, width=10)
button1.pack(side=BOTTOM)
while True:
a = a + 1
# 4.Create a frame object
check, frame = video.read()
# 5.show the frame!
cv2.imshow("Capturing",frame)
# 6.for playing
key = cv2.waitKey(1)
if key == ord('q'):
break
cv2.destroyAllWindows
# 7. image saving
showPic = cv2.imwrite("awit.png",frame)
print(showPic)
# 8. shutdown the camera
video.release()
How change the 'q' to call my button i create