我在pyqtgraph窗口中显示相机快照图像,但我无法弄清楚或了解如何关闭窗口。当我使用.close()时,窗口会变白,但它不会关闭。
下面,我使用" pg.image()打开一个显示图像的Ubuntu窗口。 .close()
只是使窗口的内容变白。关闭窗口的唯一方法是单击右上角的Ubuntu红色X.
import uvc
import pyqtgraph as pg
import logging
from PyQt4 import QtGui
import sys
""" for file read & write """
import numpy
from time import sleep
def camera_to_snapshot( ):
dev_list = uvc.device_list()
cap = uvc.Capture(dev_list[ 0]['uid'])
modes = cap.avaible_modes
cap.frame_mode = modes[1]
frame = cap.get_frame_robust()
frame.img
print("camera_to_snapshot done.")
return frame
def camera_to_image( ):
raw_image = camera_to_snapshot( ).img
return raw_image
def camera_to_window( ):
snapshot_image = camera_to_image( )
pg.image( snapshot_image )
return
camera_to_window()
sleep( 10 )
如何关闭窗口??
我在Ubuntu 16.04(Xenial Xerus)。