<filename>EzLibrarianApplication/CameraViewerWidget.py<gh_stars>0
from PyQt5 import QtCore,QtGui
from PyQt5.QtWidgets import *

class CameraViewerWidget(QWidget):
    def __init__(self, parent=None):
        super(CameraViewerWidget, self).__init__(parent)
        self.image = None

    def setImage(self, image):
        self.image = image
        sz = image.size()
        self.setMinimumSize(sz)
        self.update()

    def paintEvent(self, event):
        qp = QtGui.QPainter()
        qp.begin(self)
        if self.image:
            qp.drawImage(QtCore.QPoint(0, 0), self.image)
        qp.end()
<filename>EzLibrarianApplication/CameraViewerWidget.py<gh_stars>0
from PyQt5 import QtCore,QtGui
from PyQt5.QtWidgets import *

class CameraViewerWidget(QWidget):
    def __init__(self, parent=None):
        super(CameraViewerWidget, self).__init__(parent)
        self.image = None

    def setImage(self, image):
        self.image = image
        sz = image.size()
        self.setMinimumSize(sz)
        self.update()

    def paintEvent(self, event):
        qp = QtGui.QPainter()
        qp.begin(self)
        if self.image:
            qp.drawImage(QtCore.QPoint(0, 0), self.image)
        qp.end()