0

I display a camera snapshot image in a pyqtgraph window, but I can't figure out or find out how to close the window. When I use .close(), the window goes white, but it doesn't close.

Below, I use "pg.image( ) which opens an Ubuntu window that shows the image. .close() just makes contents of window go white. The only way to close the window is to click its Ubuntu red X in the upper right.

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 )

how to close window??

I am on Ubuntu 16.04 (Xenial Xerus).

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Doug Null
  • 7,989
  • 15
  • 69
  • 148

0 Answers0