while True: 与 app.Mainloop() 如何同步执行 只能运行一个是什么原因?

import cv2
import os
while True:
ret, frame = cap.read()

frame = frame[crop_h_start:crop_h_start + w, crop_w_start:crop_w_start + w]
# ?

frame = cv2.flip(frame, 1, dst=None)
# 镜像显示
cv2.imshow("capture", frame)
# 显示

input = cv2.waitKey(1) & 0xFF
if input == ord('z'):
    class_name = input("请输入存储目录:")
    while os.path.exists(class_name):
        class_name = input("目录已存在!请输入存储目录:")
    os.mkdir(class_name)
# 存储

elif input == ord('x'):
    cv2.imwrite("%s/%d.jpeg" % (class_name, index),
                cv2.resize(frame, (400, 400), interpolation=cv2.INTER_AREA))
    print("%s: %d 张图片" % (class_name, index))
    index += 1
# ?
if input == ord('q'):
    break
# 退出

cap.release()
cv2.destroyAllWindows()

关闭窗口

if name == ‘main‘:
app = wx.App()

main_win = MyFrame(None)
main_win.Show()
app.MainLoop()
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!