Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. [PyQt5] mouse position over label
QtWS25 Last Chance

[PyQt5] mouse position over label

Scheduled Pinned Locked Moved Solved Qt for Python
10 Posts 4 Posters 6.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    ceciacd79
    wrote on last edited by
    #1

    I would like to know how to get the mouse coordinates over a Qlabel. That is, if the Qlabel is 50 high and 100 wide, if the mouse is at the center of the label I would like to obtain the coordinates (25,50)

    jsulmJ 1 Reply Last reply
    0
    • C ceciacd79

      I would like to know how to get the mouse coordinates over a Qlabel. That is, if the Qlabel is 50 high and 100 wide, if the mouse is at the center of the label I would like to obtain the coordinates (25,50)

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @ceciacd79 You can subclass QLabel and overwrite https://doc.qt.io/qt-5/qwidget.html#mouseMoveEvent

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • C Offline
        C Offline
        ceciacd79
        wrote on last edited by
        #3

        I write this:

            def mouseMoveEvent(self, event):
                global Mouse_X
                global Mouse_Y
                try:
                    Mouse_X = event.x()
                    Mouse_Y = event.y()
                    print("mouse X,Y: {},{}" .format(Mouse_X, Mouse_Y))
                    self.lastPoint = self.GUI.LB_WORK.mapFromParent(event .pos())
                    print('X,Y WORK {}' .format(self.lastPoint))
                except Exception as msg:
                    logging.error('Error Update_work: ' + str(msg))
        

        but I can show only the mouse position in all window. I want only the position over the label. :(

        jsulmJ 1 Reply Last reply
        0
        • C ceciacd79

          I write this:

              def mouseMoveEvent(self, event):
                  global Mouse_X
                  global Mouse_Y
                  try:
                      Mouse_X = event.x()
                      Mouse_Y = event.y()
                      print("mouse X,Y: {},{}" .format(Mouse_X, Mouse_Y))
                      self.lastPoint = self.GUI.LB_WORK.mapFromParent(event .pos())
                      print('X,Y WORK {}' .format(self.lastPoint))
                  except Exception as msg:
                      logging.error('Error Update_work: ' + str(msg))
          

          but I can show only the mouse position in all window. I want only the position over the label. :(

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by SGaist
          #4

          @ceciacd79 said in [PyQt5] mouse position over label:

          I want only the position over the label

          That's why I said "subclass QLabel". Did you? Subclass it, implement the mouseMoveEvent there and use it instead of QLabel.
          Where exactly did you put your mouseMoveEvent?

          [edit: fixed typo SGaist]

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • C Offline
            C Offline
            ceciacd79
            wrote on last edited by
            #5

            sorry but I have been using QT for a while.

            from PyQt5 import QtCore, QtGui, QtWidgets, uic
            from PyQt5.QtWidgets import QInputDialog, QFileDialog, QTableWidget, QTableWidgetItem
            from PyQt5.QtCore import QObject, QThread, QTimer, QSize, pyqtSignal, pyqtSlot
            from Opencv_GUI import Ui_MainWindow
            from timeit import default_timer as timer
            
            import sys
            import cv2
            import time
            import datetime
            import logging
            import platform
            import os
            import psutil
            import numpy as np
            
            # COLOR
            black = [0, 0, 0]
            red = [0, 0, 255]
            yellow = [0, 255, 0]
            blue = [255, 0, 0]
            white = [255, 255, 255]
            
            # DIRECTORY & FILE
            BASE_DIR = os.path.dirname(os.path.abspath(__file__))
            image_dir = os.path.join(BASE_DIR, "images")
            img_Known = os.path.join(BASE_DIR, "images/known")
            img_unKnown = os.path.join(BASE_DIR, "images/unknown")
            file_RD = ""
            file_WT = ""
            
            # OPENCV
            faceCascade = cv2.CascadeClassifier("cascade/haarcascade_frontalface_default.xml")
            eyeCascade = cv2.CascadeClassifier("cascade/haarcascade_eye.xml")
            font00 = cv2.FONT_HERSHEY_SIMPLEX
            font01 = cv2.FONT_HERSHEY_PLAIN
            font02 = cv2.FONT_HERSHEY_DUPLEX
            font03 = cv2.FONT_HERSHEY_COMPLEX
            font04 = cv2.FONT_HERSHEY_TRIPLEX
            font05 = cv2.FONT_HERSHEY_COMPLEX_SMALL
            font06 = cv2.FONT_HERSHEY_SCRIPT_SIMPLEX
            font07 = cv2.FONT_HERSHEY_SCRIPT_COMPLEX
            font08 = cv2.FONT_ITALIC
            CamOpen = False
            CamFram = []
            CamWork = []
            Cam_Width = 640
            Cam_Height = 480
            Cam_Module = 0
            Frame_Count = 0
            Face_Count = 0
            Cam_scale = 0.2
            Frame_scale = 1
            Pixmap_width = Cam_Width
            Pixmap_Height = Cam_Height
            
            # WINDOW
            Mouse_X = 0
            Mouse_Y = 0
            Pos_X = 0
            Pos_Y = 0
            Frame_Width = 800
            Frame_Height = 600
            Wind_Width = 800
            Wind_Height = 600
            
            # logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s')
            logging.basicConfig(filename='LOG.txt', level=logging.DEBUG,
                                format=' %(asctime)s - %(levelname)s - %(message)s')
            
            
            class GUI(QtWidgets.QMainWindow):
                def __init__(self):
                    super(GUI, self).__init__()
                    self.GUI = Ui_MainWindow()
                    self.GUI.setupUi(self)
                    self.Gui_View()
                    self.Center_Screen()
                    self.Gui_connect()
                    self.Gui_Timer()
            
                def Gui_View(self):
                    try:
                        # logging.disable()
                        # logging.disable(logging.DEBUG)
                        #    self.setStyleSheet("font: 10pt Comic Sans MS")
                        self.setStyleSheet("font: 10pt Roboto")
            
                        header = self.GUI.TW_ORIGINAL.horizontalHeader()
                        header.setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
                        header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
            
                        self.GUI.TW_ORIGINAL.setMinimumHeight(self.GUI.TW_ORIGINAL.rowCount()*40)
                        self.GUI.TW_WORK.setMinimumHeight(self.GUI.TW_WORK.rowCount()*40)
                        self.GUI.TW_ORIGINAL.setMaximumHeight(self.GUI.TW_ORIGINAL.rowCount()*40)
                        self.GUI.TW_WORK.setMaximumHeight(self.GUI.TW_WORK.rowCount()*40)
            
                        self.GUI.TW_ORIGINAL.setItem(0, 0, QTableWidgetItem("FPS:"))
                        self.GUI.TW_ORIGINAL.setItem(1, 0, QTableWidgetItem("width:"))
                        self.GUI.TW_ORIGINAL.setItem(2, 0, QTableWidgetItem("height:"))
                        self.GUI.TW_ORIGINAL.setItem(3, 0, QTableWidgetItem("aspect ratio "))
            
                        header = self.GUI.TW_WORK.horizontalHeader()
                        header.setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
                        header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
                        self.GUI.TW_WORK.setItem(0, 0, QTableWidgetItem("Faces:"))
                        self.GUI.TW_WORK.setItem(1, 0, QTableWidgetItem("width:"))
                        self.GUI.TW_WORK.setItem(2, 0, QTableWidgetItem("height:"))
                        self.GUI.TW_WORK.setItem(3, 0, QTableWidgetItem("aspect ratio "))
                    except Exception as msg:
                        logging.error('Error: ' + str(msg))
            
                def Center_Screen(self):
                    try:
                        screen = app.primaryScreen()
                        size = screen.size()
                        logging.info('Screen width {}, height {}' .format(size.width(), size.height()))
                        self.resize(size.width()*3/4, size.height()*3/4)
                    except Exception as msg:
                        logging.error('Error: ' + str(msg))
            
                def Gui_connect(self):
                    '''
                    '''
                    # Designer statusbar
                    self.GUI.statusbar.showMessage('Start program.')
                    # Designer menuFile
                    self.GUI.actionExit.triggered.connect(self.GUI_exit)
                    self.GUI.actionOpen_log_File.triggered.connect(self.GUI_LogFile)
                    # Designer menuCamera
                    self.GUI.CheckCam0.triggered.connect(self.Gui_Cam)
                    self.GUI.CheckCam1.triggered.connect(self.Gui_Cam)
                    # Designer menuInfo
                    self.GUI.actionInfo.triggered.connect(self.GUI_info)
                    # Designer PushButton
                    self.GUI.BT_OpenCAM.clicked.connect(self.GUI_OpenCam)
                    self.GUI.BT_OpenFile.clicked.connect(self.GUI_OpenFile)
                    # Label
                    self.GUI.LB_WORK.mousePressEvent = self.GUI_GetRGB
            
                def Gui_Timer(self):
                    try:
                        self.timer01 = QTimer()
                        self.timer01.timeout.connect(self.time_ck01)
            
                        self.timer1 = QTimer()
                        self.timer1.timeout.connect(self.time_ck1)
                        self.timer1.start(1000)
            
                        self.timer2 = QTimer()
                        self.timer2.timeout.connect(self.Update_work)
            
                    except Exception as msg:
                        logging.error('Error: ' + str(msg))
            
                def GUI_exit(self):
                    try:
                        logging.info('Exit program.')
                        self.GUI.statusbar.showMessage('Exit program.')
                        cap.release()
                        sys.exit()
            
                    except Exception as msg:
                        logging.error('Error: ' + str(msg))
            
                def GUI_LogFile(self):
                    try:
                        os.startfile('LOG.txt')
                        logging.info('Open Log File.')
                        self.GUI.statusbar.showMessage('Open Log File.')
            
                    except Exception as msg:
                        logging.error('Error: ' + str(msg))
            
                def GUI_info(self):
                    try:
                        logging.info('Info program.')
                        self.GUI.statusbar.showMessage('Info program.')
            
                    except Exception as msg:
                        logging.error('Error: ' + str(msg))
            
                def Gui_Cam(self):
                    global Cam_Module
                    try:
                        if Cam_Module == 0:
                            self.GUI.CheckCam0.setChecked(False)
                            self.GUI.CheckCam1.setChecked(True)
                            Cam_Module = 1
                        else:
                            self.GUI.CheckCam0.setChecked(True)
                            self.GUI.CheckCam1.setChecked(False)
                            Cam_Module = 0
            
                        logging.info('Change CAM {}.' .format(Cam_Module))
                        self.GUI.statusbar.showMessage('Select active CAM {}.' .format(Cam_Module))
                    except Exception as msg:
                        logging.error('Error: ' + str(msg))
            
                def GUI_OpenCam(self):
                    global Cam_Module
                    global CamOpen
                    global CamFram
                    global cap
                    global Cam_Width
                    global Cam_Height
                    try:
                        if not CamOpen:
                            cap = cv2.VideoCapture(Cam_Module)
                            logging.info('Default Camera resolution {} x {}' .format(
                                cap.get(cv2.CAP_PROP_FRAME_WIDTH), cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
            
                            cap.set(cv2.CAP_PROP_FRAME_HEIGHT, Cam_Height)
                            cap.set(cv2.CAP_PROP_FRAME_WIDTH, Cam_Width)
            
                            logging.info('New Camera resolution {} x {}' .format(
                                cap.get(cv2.CAP_PROP_FRAME_WIDTH), cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
                            aspect_ratio = (cap.get(cv2.CAP_PROP_FRAME_WIDTH) /
                                            cap.get(cv2.CAP_PROP_FRAME_HEIGHT))*9
                            self.GUI.TW_ORIGINAL.setItem(1, 1, QTableWidgetItem(
                                str(cap.get(cv2.CAP_PROP_FRAME_WIDTH))))
                            self.GUI.TW_ORIGINAL.setItem(2, 1, QTableWidgetItem(
                                str(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))))
                            self.GUI.TW_ORIGINAL.setItem(3, 1, QTableWidgetItem(
                                str('{}/9' .format(int(aspect_ratio)))))
            
                            CamOpen, NewFram = cap.read()
                            CamFram.append(NewFram)
                            self.resizeFrame()
                            logging.info('Open CAM {},{}.' .format(Cam_Module, CamOpen))
                            self.GUI.statusbar.showMessage('Open CAM {},{}.' .format(Cam_Module, CamOpen))
                            self.timer01.start(10)
                            self.timer2.start(10)
                        else:
                            cap.release()
                            CamOpen = False
                            logging.info('Close CAM {},{}.' .format(Cam_Module, CamOpen))
                            self.timer01.stop()
                            self.timer2.stop()
            
                    except Exception as msg:
                        cap.release()
                        logging.error('Error: ' + str(msg))
            
                def GUI_OpenFile(self):
                    global file_RD
                    try:
                        file_RD = QFileDialog.getOpenFileName(
                            self, 'Open File', '', "Images files (*.jpg *.jpeg)")
                        NewFram = cv2.imread(str(file_RD[0]))
                        NewFram = cv2.cvtColor(NewFram, cv2.COLOR_BGR2RGB)
            
                        pixmap = self.GUI_Resize_PIX(NewFram)
                        self.GUI.LB_ORIGINAL.setPixmap(pixmap)
            
                        logging.info('Open File {}.' .format(file_RD[0]))
                        self.GUI.statusbar.showMessage('Open File {}.' .format(file_RD[0]))
            
                    except Exception as msg:
                        logging.error('Error: ' + str(msg))
            
                def time_ck01(self):
                    '''
                        Run function every 0.1s
                    '''
                    global CamOpen
                    global CamFram
                    global cap
                    global Frame_Count
                    global Frame_Width
                    global Frame_Height
                    try:
                        if CamOpen:
                            Frame_Count += 1
                            CamOpen, NewFram = cap.read()
                            NewFram = cv2.flip(NewFram, 1)
                            CamFram.append(NewFram)
                            NewFram = cv2.cvtColor(NewFram, cv2.COLOR_BGR2RGB)
                            pixmap = self.GUI_Resize_PIX(NewFram)
                            self.GUI.LB_ORIGINAL.setPixmap(pixmap)
            
                    except Exception as msg:
                        logging.error('Error: ' + str(msg))
            
                def time_ck1(self):
                    '''
                        Run function every 1s
                    '''
                    global Frame_Width
                    global Frame_Height
                    global Frame_Count
                    global Face_Count
                    global Mouse_X
                    global Mouse_Y
                    global Pos_X
                    global Pos_Y
            
                    Frame_Width = self.GUI.LB_ORIGINAL.geometry().width() - 2
                    Frame_Height = self.GUI.LB_ORIGINAL.geometry().height() - 2
            
                    self.GUI.LB_CPU.setText("CPU {}%" .format(psutil.cpu_times_percent()[0]))
                    self.GUI.LB_FREQ.setText("{}GHz" .format((psutil.cpu_freq()[0])/1000))
                    self.GUI.LB_RAM.setText("RAM {}%" .format(psutil.virtual_memory()[2]))
            
                    # Update Label
                    self.GUI.TW_ORIGINAL.setItem(0, 1, QTableWidgetItem(str(Frame_Count)))
            
                    self.GUI.TW_WORK.setItem(0, 1, QTableWidgetItem(str(Face_Count)))
                    self.GUI.TW_WORK.setItem(1, 1, QTableWidgetItem(str(Frame_Width)))
                    self.GUI.TW_WORK.setItem(2, 1, QTableWidgetItem(str(Frame_Height)))
            
                    logging.debug("Mouse X,Y {},{}" .format(Mouse_X, Mouse_Y))
                    logging.debug('MainWindow position X,Y {},{}' .format(Pos_X, Pos_Y))
            
                    if CamOpen:
                        Frame_Count = 0
            
                def mouseMoveEvent(self, event):
                    global Mouse_X
                    global Mouse_Y
                    try:
                        Mouse_X = event.x()
                        Mouse_Y = event.y()
                        print("mouse X,Y: {},{}" .format(Mouse_X, Mouse_Y))
                        self.lastPoint = self.GUI.LB_WORK.mapFromParent(event.pos())
                        print('X,Y WORK {}' .format(self.lastPoint))
            
                    except Exception as msg:
                        logging.error('Error Update_work: ' + str(msg))
            
                def resizeEvent(self, event):
                    try:
                        logging.debug('Application resized {},{}' .format(
                            application.frameGeometry().width(), application.frameGeometry().height()))
                        logging.debug('Widget resized {},{}' .format(
                            application.size().width(), application.size().height()))
            
                        print("width OR {}, width WK {}" .format(
                            self.GUI.LB_ORIGINAL.width(), self.GUI.LB_WORK.width()))
            
                        self.resizeFrame()
            
                    except Exception as msg:
                        logging.error('Error: ' + str(msg))
            
                def resizeFrame(self):
                    global Frame_scale
                    for Frame_scale in range(0, 100, 1):
                        if (Pixmap_width * Frame_scale * 0.1 >= self.GUI.LB_ORIGINAL.size().width()) or (Pixmap_Height * Frame_scale * 0.1 >= self.GUI.LB_ORIGINAL.size().height()):
                            Frame_scale = (Frame_scale - 1) * 0.1
                            break
            
                def moveEvent(self, event):
                    global Pos_X
                    global Pos_Y
                    try:
                        Pos_X = self.pos().x()
                        Pos_Y = self.pos().y()
                    except Exception as msg:
                        logging.error('Error: ' + str(msg))
            
                def mousePressEvent(self, event):
                    try:
                        if event.type() == QtCore.QEvent.MouseButtonPress:
                            if event.button() == QtCore.Qt.RightButton:
                                logging.info('Press Right Button {}' .format(self.underMouse()))
                            elif event.button() == QtCore.Qt.LeftButton:
                                logging.info('Press Left Button {}' .format(self.underMouse()))
                            else:
                                pass
            
                    except Exception as msg:
                        logging.error('Error: ' + str(msg))
            
                def Update_work(self):
                    '''
            
                    '''
                    global CamOpen
                    global CamFram
                    global Face_Count
                    global Cam_scale
                    try:
                        if CamOpen:
                            NewFram = cv2.cvtColor(CamFram.pop(len(CamFram)-1), cv2.COLOR_BGR2RGB)
                            # Low_Frame = cv2.resize(NewFram, None, fx=Cam_scale, fy=Cam_scale)
                            gray_cam = cv2.cvtColor(NewFram, cv2.COLOR_BGR2GRAY)
            
                            faces = faceCascade.detectMultiScale(
                                gray_cam, scaleFactor=1.3, minNeighbors=5, minSize=(50, 50), flags=cv2.CASCADE_SCALE_IMAGE)
                            if len(faces) > 0:
                                for (x, y, w, h) in faces:
                                    cv2.rectangle(NewFram, (x, y), (x+w, y+h), yellow, 2)
                                    cv2.putText(NewFram, "{},{}" .format(x, y), (x, y-10), font08, 0.5, white)
            
                            Face_Count = len(faces)
                            pixmap = self.GUI_Resize_PIX(NewFram)
                            self.GUI.LB_WORK.setPixmap(pixmap)
            
                    except Exception as msg:
                        logging.error('Error Update_work: ' + str(msg))
            
                def GUI_GetRGB(self, event):
                    try:
                        print("Position LB_Work {},{}" .format(
                            self.GUI.LB_WORK.pos().x(), self.GUI.LB_WORK.pos().y()))
                        print("Position GB_Work {},{}" .format(
                            self.GUI.GB_WORK.pos().x(), self.GUI.GB_WORK.pos().y()))
                        print("Position Mouse {},{}" .format(
                            self.GUI.GB_WORK.pos().x(), self.GUI.GB_WORK.pos().y()))
                    except Exception as msg:
                        logging.error('Error Update_work: ' + str(msg))
            
                def GUI_Resize_PIX(self, rd_img):
                    global Cam_scale
                    global Frame_scale
                    global Pixmap_width
                    global Pixmap_Height
                    try:
                        image = QtGui.QImage(
                            rd_img, rd_img.shape[1], rd_img.shape[0], QtGui.QImage.Format_RGB888)
                        Pixmap_width = image.width()
                        Pixmap_Height = image.height()
                        pixmap = QtGui.QPixmap.fromImage(image)
                        pixmap = pixmap.scaled(Frame_Width * Frame_scale, Frame_Height *
                                               Frame_scale, QtCore.Qt.KeepAspectRatio)
                        # pixmap = pixmap.scaledToWidth(Frame_Width*Frame_scale)
            
                        print('PIXMAP {}.' .format(pixmap.geometry()))
            
                        return pixmap
                    except Exception as msg:
                        logging.error('Error Update_work: ' + str(msg))
            
            
            logging.info('##############################################################')
            logging.info('Run application.')
            app = QtWidgets.QApplication([])
            application = GUI()
            application.show()
            sys.exit(app.exec())
            
            
            JonBJ 1 Reply Last reply
            0
            • C ceciacd79

              sorry but I have been using QT for a while.

              from PyQt5 import QtCore, QtGui, QtWidgets, uic
              from PyQt5.QtWidgets import QInputDialog, QFileDialog, QTableWidget, QTableWidgetItem
              from PyQt5.QtCore import QObject, QThread, QTimer, QSize, pyqtSignal, pyqtSlot
              from Opencv_GUI import Ui_MainWindow
              from timeit import default_timer as timer
              
              import sys
              import cv2
              import time
              import datetime
              import logging
              import platform
              import os
              import psutil
              import numpy as np
              
              # COLOR
              black = [0, 0, 0]
              red = [0, 0, 255]
              yellow = [0, 255, 0]
              blue = [255, 0, 0]
              white = [255, 255, 255]
              
              # DIRECTORY & FILE
              BASE_DIR = os.path.dirname(os.path.abspath(__file__))
              image_dir = os.path.join(BASE_DIR, "images")
              img_Known = os.path.join(BASE_DIR, "images/known")
              img_unKnown = os.path.join(BASE_DIR, "images/unknown")
              file_RD = ""
              file_WT = ""
              
              # OPENCV
              faceCascade = cv2.CascadeClassifier("cascade/haarcascade_frontalface_default.xml")
              eyeCascade = cv2.CascadeClassifier("cascade/haarcascade_eye.xml")
              font00 = cv2.FONT_HERSHEY_SIMPLEX
              font01 = cv2.FONT_HERSHEY_PLAIN
              font02 = cv2.FONT_HERSHEY_DUPLEX
              font03 = cv2.FONT_HERSHEY_COMPLEX
              font04 = cv2.FONT_HERSHEY_TRIPLEX
              font05 = cv2.FONT_HERSHEY_COMPLEX_SMALL
              font06 = cv2.FONT_HERSHEY_SCRIPT_SIMPLEX
              font07 = cv2.FONT_HERSHEY_SCRIPT_COMPLEX
              font08 = cv2.FONT_ITALIC
              CamOpen = False
              CamFram = []
              CamWork = []
              Cam_Width = 640
              Cam_Height = 480
              Cam_Module = 0
              Frame_Count = 0
              Face_Count = 0
              Cam_scale = 0.2
              Frame_scale = 1
              Pixmap_width = Cam_Width
              Pixmap_Height = Cam_Height
              
              # WINDOW
              Mouse_X = 0
              Mouse_Y = 0
              Pos_X = 0
              Pos_Y = 0
              Frame_Width = 800
              Frame_Height = 600
              Wind_Width = 800
              Wind_Height = 600
              
              # logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s')
              logging.basicConfig(filename='LOG.txt', level=logging.DEBUG,
                                  format=' %(asctime)s - %(levelname)s - %(message)s')
              
              
              class GUI(QtWidgets.QMainWindow):
                  def __init__(self):
                      super(GUI, self).__init__()
                      self.GUI = Ui_MainWindow()
                      self.GUI.setupUi(self)
                      self.Gui_View()
                      self.Center_Screen()
                      self.Gui_connect()
                      self.Gui_Timer()
              
                  def Gui_View(self):
                      try:
                          # logging.disable()
                          # logging.disable(logging.DEBUG)
                          #    self.setStyleSheet("font: 10pt Comic Sans MS")
                          self.setStyleSheet("font: 10pt Roboto")
              
                          header = self.GUI.TW_ORIGINAL.horizontalHeader()
                          header.setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
                          header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
              
                          self.GUI.TW_ORIGINAL.setMinimumHeight(self.GUI.TW_ORIGINAL.rowCount()*40)
                          self.GUI.TW_WORK.setMinimumHeight(self.GUI.TW_WORK.rowCount()*40)
                          self.GUI.TW_ORIGINAL.setMaximumHeight(self.GUI.TW_ORIGINAL.rowCount()*40)
                          self.GUI.TW_WORK.setMaximumHeight(self.GUI.TW_WORK.rowCount()*40)
              
                          self.GUI.TW_ORIGINAL.setItem(0, 0, QTableWidgetItem("FPS:"))
                          self.GUI.TW_ORIGINAL.setItem(1, 0, QTableWidgetItem("width:"))
                          self.GUI.TW_ORIGINAL.setItem(2, 0, QTableWidgetItem("height:"))
                          self.GUI.TW_ORIGINAL.setItem(3, 0, QTableWidgetItem("aspect ratio "))
              
                          header = self.GUI.TW_WORK.horizontalHeader()
                          header.setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
                          header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
                          self.GUI.TW_WORK.setItem(0, 0, QTableWidgetItem("Faces:"))
                          self.GUI.TW_WORK.setItem(1, 0, QTableWidgetItem("width:"))
                          self.GUI.TW_WORK.setItem(2, 0, QTableWidgetItem("height:"))
                          self.GUI.TW_WORK.setItem(3, 0, QTableWidgetItem("aspect ratio "))
                      except Exception as msg:
                          logging.error('Error: ' + str(msg))
              
                  def Center_Screen(self):
                      try:
                          screen = app.primaryScreen()
                          size = screen.size()
                          logging.info('Screen width {}, height {}' .format(size.width(), size.height()))
                          self.resize(size.width()*3/4, size.height()*3/4)
                      except Exception as msg:
                          logging.error('Error: ' + str(msg))
              
                  def Gui_connect(self):
                      '''
                      '''
                      # Designer statusbar
                      self.GUI.statusbar.showMessage('Start program.')
                      # Designer menuFile
                      self.GUI.actionExit.triggered.connect(self.GUI_exit)
                      self.GUI.actionOpen_log_File.triggered.connect(self.GUI_LogFile)
                      # Designer menuCamera
                      self.GUI.CheckCam0.triggered.connect(self.Gui_Cam)
                      self.GUI.CheckCam1.triggered.connect(self.Gui_Cam)
                      # Designer menuInfo
                      self.GUI.actionInfo.triggered.connect(self.GUI_info)
                      # Designer PushButton
                      self.GUI.BT_OpenCAM.clicked.connect(self.GUI_OpenCam)
                      self.GUI.BT_OpenFile.clicked.connect(self.GUI_OpenFile)
                      # Label
                      self.GUI.LB_WORK.mousePressEvent = self.GUI_GetRGB
              
                  def Gui_Timer(self):
                      try:
                          self.timer01 = QTimer()
                          self.timer01.timeout.connect(self.time_ck01)
              
                          self.timer1 = QTimer()
                          self.timer1.timeout.connect(self.time_ck1)
                          self.timer1.start(1000)
              
                          self.timer2 = QTimer()
                          self.timer2.timeout.connect(self.Update_work)
              
                      except Exception as msg:
                          logging.error('Error: ' + str(msg))
              
                  def GUI_exit(self):
                      try:
                          logging.info('Exit program.')
                          self.GUI.statusbar.showMessage('Exit program.')
                          cap.release()
                          sys.exit()
              
                      except Exception as msg:
                          logging.error('Error: ' + str(msg))
              
                  def GUI_LogFile(self):
                      try:
                          os.startfile('LOG.txt')
                          logging.info('Open Log File.')
                          self.GUI.statusbar.showMessage('Open Log File.')
              
                      except Exception as msg:
                          logging.error('Error: ' + str(msg))
              
                  def GUI_info(self):
                      try:
                          logging.info('Info program.')
                          self.GUI.statusbar.showMessage('Info program.')
              
                      except Exception as msg:
                          logging.error('Error: ' + str(msg))
              
                  def Gui_Cam(self):
                      global Cam_Module
                      try:
                          if Cam_Module == 0:
                              self.GUI.CheckCam0.setChecked(False)
                              self.GUI.CheckCam1.setChecked(True)
                              Cam_Module = 1
                          else:
                              self.GUI.CheckCam0.setChecked(True)
                              self.GUI.CheckCam1.setChecked(False)
                              Cam_Module = 0
              
                          logging.info('Change CAM {}.' .format(Cam_Module))
                          self.GUI.statusbar.showMessage('Select active CAM {}.' .format(Cam_Module))
                      except Exception as msg:
                          logging.error('Error: ' + str(msg))
              
                  def GUI_OpenCam(self):
                      global Cam_Module
                      global CamOpen
                      global CamFram
                      global cap
                      global Cam_Width
                      global Cam_Height
                      try:
                          if not CamOpen:
                              cap = cv2.VideoCapture(Cam_Module)
                              logging.info('Default Camera resolution {} x {}' .format(
                                  cap.get(cv2.CAP_PROP_FRAME_WIDTH), cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
              
                              cap.set(cv2.CAP_PROP_FRAME_HEIGHT, Cam_Height)
                              cap.set(cv2.CAP_PROP_FRAME_WIDTH, Cam_Width)
              
                              logging.info('New Camera resolution {} x {}' .format(
                                  cap.get(cv2.CAP_PROP_FRAME_WIDTH), cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
                              aspect_ratio = (cap.get(cv2.CAP_PROP_FRAME_WIDTH) /
                                              cap.get(cv2.CAP_PROP_FRAME_HEIGHT))*9
                              self.GUI.TW_ORIGINAL.setItem(1, 1, QTableWidgetItem(
                                  str(cap.get(cv2.CAP_PROP_FRAME_WIDTH))))
                              self.GUI.TW_ORIGINAL.setItem(2, 1, QTableWidgetItem(
                                  str(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))))
                              self.GUI.TW_ORIGINAL.setItem(3, 1, QTableWidgetItem(
                                  str('{}/9' .format(int(aspect_ratio)))))
              
                              CamOpen, NewFram = cap.read()
                              CamFram.append(NewFram)
                              self.resizeFrame()
                              logging.info('Open CAM {},{}.' .format(Cam_Module, CamOpen))
                              self.GUI.statusbar.showMessage('Open CAM {},{}.' .format(Cam_Module, CamOpen))
                              self.timer01.start(10)
                              self.timer2.start(10)
                          else:
                              cap.release()
                              CamOpen = False
                              logging.info('Close CAM {},{}.' .format(Cam_Module, CamOpen))
                              self.timer01.stop()
                              self.timer2.stop()
              
                      except Exception as msg:
                          cap.release()
                          logging.error('Error: ' + str(msg))
              
                  def GUI_OpenFile(self):
                      global file_RD
                      try:
                          file_RD = QFileDialog.getOpenFileName(
                              self, 'Open File', '', "Images files (*.jpg *.jpeg)")
                          NewFram = cv2.imread(str(file_RD[0]))
                          NewFram = cv2.cvtColor(NewFram, cv2.COLOR_BGR2RGB)
              
                          pixmap = self.GUI_Resize_PIX(NewFram)
                          self.GUI.LB_ORIGINAL.setPixmap(pixmap)
              
                          logging.info('Open File {}.' .format(file_RD[0]))
                          self.GUI.statusbar.showMessage('Open File {}.' .format(file_RD[0]))
              
                      except Exception as msg:
                          logging.error('Error: ' + str(msg))
              
                  def time_ck01(self):
                      '''
                          Run function every 0.1s
                      '''
                      global CamOpen
                      global CamFram
                      global cap
                      global Frame_Count
                      global Frame_Width
                      global Frame_Height
                      try:
                          if CamOpen:
                              Frame_Count += 1
                              CamOpen, NewFram = cap.read()
                              NewFram = cv2.flip(NewFram, 1)
                              CamFram.append(NewFram)
                              NewFram = cv2.cvtColor(NewFram, cv2.COLOR_BGR2RGB)
                              pixmap = self.GUI_Resize_PIX(NewFram)
                              self.GUI.LB_ORIGINAL.setPixmap(pixmap)
              
                      except Exception as msg:
                          logging.error('Error: ' + str(msg))
              
                  def time_ck1(self):
                      '''
                          Run function every 1s
                      '''
                      global Frame_Width
                      global Frame_Height
                      global Frame_Count
                      global Face_Count
                      global Mouse_X
                      global Mouse_Y
                      global Pos_X
                      global Pos_Y
              
                      Frame_Width = self.GUI.LB_ORIGINAL.geometry().width() - 2
                      Frame_Height = self.GUI.LB_ORIGINAL.geometry().height() - 2
              
                      self.GUI.LB_CPU.setText("CPU {}%" .format(psutil.cpu_times_percent()[0]))
                      self.GUI.LB_FREQ.setText("{}GHz" .format((psutil.cpu_freq()[0])/1000))
                      self.GUI.LB_RAM.setText("RAM {}%" .format(psutil.virtual_memory()[2]))
              
                      # Update Label
                      self.GUI.TW_ORIGINAL.setItem(0, 1, QTableWidgetItem(str(Frame_Count)))
              
                      self.GUI.TW_WORK.setItem(0, 1, QTableWidgetItem(str(Face_Count)))
                      self.GUI.TW_WORK.setItem(1, 1, QTableWidgetItem(str(Frame_Width)))
                      self.GUI.TW_WORK.setItem(2, 1, QTableWidgetItem(str(Frame_Height)))
              
                      logging.debug("Mouse X,Y {},{}" .format(Mouse_X, Mouse_Y))
                      logging.debug('MainWindow position X,Y {},{}' .format(Pos_X, Pos_Y))
              
                      if CamOpen:
                          Frame_Count = 0
              
                  def mouseMoveEvent(self, event):
                      global Mouse_X
                      global Mouse_Y
                      try:
                          Mouse_X = event.x()
                          Mouse_Y = event.y()
                          print("mouse X,Y: {},{}" .format(Mouse_X, Mouse_Y))
                          self.lastPoint = self.GUI.LB_WORK.mapFromParent(event.pos())
                          print('X,Y WORK {}' .format(self.lastPoint))
              
                      except Exception as msg:
                          logging.error('Error Update_work: ' + str(msg))
              
                  def resizeEvent(self, event):
                      try:
                          logging.debug('Application resized {},{}' .format(
                              application.frameGeometry().width(), application.frameGeometry().height()))
                          logging.debug('Widget resized {},{}' .format(
                              application.size().width(), application.size().height()))
              
                          print("width OR {}, width WK {}" .format(
                              self.GUI.LB_ORIGINAL.width(), self.GUI.LB_WORK.width()))
              
                          self.resizeFrame()
              
                      except Exception as msg:
                          logging.error('Error: ' + str(msg))
              
                  def resizeFrame(self):
                      global Frame_scale
                      for Frame_scale in range(0, 100, 1):
                          if (Pixmap_width * Frame_scale * 0.1 >= self.GUI.LB_ORIGINAL.size().width()) or (Pixmap_Height * Frame_scale * 0.1 >= self.GUI.LB_ORIGINAL.size().height()):
                              Frame_scale = (Frame_scale - 1) * 0.1
                              break
              
                  def moveEvent(self, event):
                      global Pos_X
                      global Pos_Y
                      try:
                          Pos_X = self.pos().x()
                          Pos_Y = self.pos().y()
                      except Exception as msg:
                          logging.error('Error: ' + str(msg))
              
                  def mousePressEvent(self, event):
                      try:
                          if event.type() == QtCore.QEvent.MouseButtonPress:
                              if event.button() == QtCore.Qt.RightButton:
                                  logging.info('Press Right Button {}' .format(self.underMouse()))
                              elif event.button() == QtCore.Qt.LeftButton:
                                  logging.info('Press Left Button {}' .format(self.underMouse()))
                              else:
                                  pass
              
                      except Exception as msg:
                          logging.error('Error: ' + str(msg))
              
                  def Update_work(self):
                      '''
              
                      '''
                      global CamOpen
                      global CamFram
                      global Face_Count
                      global Cam_scale
                      try:
                          if CamOpen:
                              NewFram = cv2.cvtColor(CamFram.pop(len(CamFram)-1), cv2.COLOR_BGR2RGB)
                              # Low_Frame = cv2.resize(NewFram, None, fx=Cam_scale, fy=Cam_scale)
                              gray_cam = cv2.cvtColor(NewFram, cv2.COLOR_BGR2GRAY)
              
                              faces = faceCascade.detectMultiScale(
                                  gray_cam, scaleFactor=1.3, minNeighbors=5, minSize=(50, 50), flags=cv2.CASCADE_SCALE_IMAGE)
                              if len(faces) > 0:
                                  for (x, y, w, h) in faces:
                                      cv2.rectangle(NewFram, (x, y), (x+w, y+h), yellow, 2)
                                      cv2.putText(NewFram, "{},{}" .format(x, y), (x, y-10), font08, 0.5, white)
              
                              Face_Count = len(faces)
                              pixmap = self.GUI_Resize_PIX(NewFram)
                              self.GUI.LB_WORK.setPixmap(pixmap)
              
                      except Exception as msg:
                          logging.error('Error Update_work: ' + str(msg))
              
                  def GUI_GetRGB(self, event):
                      try:
                          print("Position LB_Work {},{}" .format(
                              self.GUI.LB_WORK.pos().x(), self.GUI.LB_WORK.pos().y()))
                          print("Position GB_Work {},{}" .format(
                              self.GUI.GB_WORK.pos().x(), self.GUI.GB_WORK.pos().y()))
                          print("Position Mouse {},{}" .format(
                              self.GUI.GB_WORK.pos().x(), self.GUI.GB_WORK.pos().y()))
                      except Exception as msg:
                          logging.error('Error Update_work: ' + str(msg))
              
                  def GUI_Resize_PIX(self, rd_img):
                      global Cam_scale
                      global Frame_scale
                      global Pixmap_width
                      global Pixmap_Height
                      try:
                          image = QtGui.QImage(
                              rd_img, rd_img.shape[1], rd_img.shape[0], QtGui.QImage.Format_RGB888)
                          Pixmap_width = image.width()
                          Pixmap_Height = image.height()
                          pixmap = QtGui.QPixmap.fromImage(image)
                          pixmap = pixmap.scaled(Frame_Width * Frame_scale, Frame_Height *
                                                 Frame_scale, QtCore.Qt.KeepAspectRatio)
                          # pixmap = pixmap.scaledToWidth(Frame_Width*Frame_scale)
              
                          print('PIXMAP {}.' .format(pixmap.geometry()))
              
                          return pixmap
                      except Exception as msg:
                          logging.error('Error Update_work: ' + str(msg))
              
              
              logging.info('##############################################################')
              logging.info('Run application.')
              app = QtWidgets.QApplication([])
              application = GUI()
              application.show()
              sys.exit(app.exec())
              
              
              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @ceciacd79
              That is a lot of code to paste for people to look through for a question about mouse position over a label. I have searched the page and your code has no occurrence of QLabel in it, So how does it relate to the question?

              I would like to know how to get the mouse coordinates over a Qlabel.

              C 1 Reply Last reply
              0
              • C Offline
                C Offline
                ceciacd79
                wrote on last edited by
                #7

                thanks for the info jsulm! I searched google "subclass QLabel" and found the solution. this will be very useful to me in the future.

                1 Reply Last reply
                1
                • JonBJ JonB

                  @ceciacd79
                  That is a lot of code to paste for people to look through for a question about mouse position over a label. I have searched the page and your code has no occurrence of QLabel in it, So how does it relate to the question?

                  I would like to know how to get the mouse coordinates over a Qlabel.

                  C Offline
                  C Offline
                  ceciacd79
                  wrote on last edited by
                  #8

                  as i said i have been playing with QT and python for 1 week.
                  @JonB said in [PyQt5] mouse position over label:

                  That is a lot of code to paste for people to look through for a question about mouse position over a label. I have searched the page and your code has no occurrence of QLabel in it, So how does it relate to the question?

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    ceciacd79
                    wrote on last edited by
                    #9

                    thank you all. you are very kind

                    @Denni-0 said in [PyQt5] mouse position over label:

                    @ceciacd79 nice but not enough code as you do not include the UI ( @JonB that is where the QLabel can be found btw ) that you are importing as such this code cannot be ran and validated -- and the the issue you are trying to solve thus much harder to answer.
                    With this code base and the UI I can probably tell you what you need to do to get those coordinates you want -- I just did not chime in earlier because I did not want to create the MUC (Minimal Usable Code) it would have required to figure out how to implement what you are asking -- but since you have supplied this -- all I need now is your UI and I am pretty sure I can get this answered for you

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      ceciacd79
                      wrote on last edited by
                      #10

                      @Denni-0 said in [PyQt5] mouse position over label:

                      are you going to include that UI you import

                      # -*- coding: utf-8 -*-
                      
                      # Form implementation generated from reading ui file 'Opencv.ui'
                      #
                      # Created by: PyQt5 UI code generator 5.13.0
                      #
                      # WARNING! All changes made in this file will be lost!
                      
                      
                      from mouse_over import mouse_over
                      import QT_image_rc
                      from PyQt5 import QtCore, QtGui, QtWidgets
                      
                      
                      class Ui_MainWindow(object):
                          def setupUi(self, MainWindow):
                              MainWindow.setObjectName("MainWindow")
                              MainWindow.resize(835, 574)
                              MainWindow.setMinimumSize(QtCore.QSize(0, 0))
                              palette = QtGui.QPalette()
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
                              brush = QtGui.QBrush(QtGui.QColor(127, 127, 127))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
                              brush = QtGui.QBrush(QtGui.QColor(170, 170, 170))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.PlaceholderText, brush)
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
                              brush = QtGui.QBrush(QtGui.QColor(127, 127, 127))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
                              brush = QtGui.QBrush(QtGui.QColor(170, 170, 170))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush)
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.PlaceholderText, brush)
                              brush = QtGui.QBrush(QtGui.QColor(127, 127, 127))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
                              brush = QtGui.QBrush(QtGui.QColor(127, 127, 127))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
                              brush = QtGui.QBrush(QtGui.QColor(170, 170, 170))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
                              brush = QtGui.QBrush(QtGui.QColor(127, 127, 127))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
                              brush = QtGui.QBrush(QtGui.QColor(127, 127, 127))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
                              brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush)
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
                              brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128))
                              brush.setStyle(QtCore.Qt.SolidPattern)
                              palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.PlaceholderText, brush)
                              MainWindow.setPalette(palette)
                              icon = QtGui.QIcon()
                              icon.addPixmap(QtGui.QPixmap(":/Logo/resource/LOGO/LOGO 01.png"),
                                             QtGui.QIcon.Normal, QtGui.QIcon.Off)
                              MainWindow.setWindowIcon(icon)
                              MainWindow.setIconSize(QtCore.QSize(24, 24))
                              self.centralwidget = QtWidgets.QWidget(MainWindow)
                              sizePolicy = QtWidgets.QSizePolicy(
                                  QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
                              sizePolicy.setHorizontalStretch(1)
                              sizePolicy.setVerticalStretch(1)
                              sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth())
                              self.centralwidget.setSizePolicy(sizePolicy)
                              self.centralwidget.setMinimumSize(QtCore.QSize(800, 0))
                              self.centralwidget.setSizeIncrement(QtCore.QSize(1, 1))
                              self.centralwidget.setMouseTracking(False)
                              self.centralwidget.setObjectName("centralwidget")
                              self.GD_WIDGET = QtWidgets.QGridLayout(self.centralwidget)
                              self.GD_WIDGET.setContentsMargins(9, 9, 9, 9)
                              self.GD_WIDGET.setSpacing(6)
                              self.GD_WIDGET.setObjectName("GD_WIDGET")
                              self.GB_ORIGINAL = QtWidgets.QGroupBox(self.centralwidget)
                              self.GB_ORIGINAL.setMinimumSize(QtCore.QSize(300, 0))
                              self.GB_ORIGINAL.setObjectName("GB_ORIGINAL")
                              self.GL_ORIGINAL = QtWidgets.QGridLayout(self.GB_ORIGINAL)
                              self.GL_ORIGINAL.setContentsMargins(9, 9, 9, 9)
                              self.GL_ORIGINAL.setSpacing(6)
                              self.GL_ORIGINAL.setObjectName("GL_ORIGINAL")
                              self.GD_ORIGINAL = QtWidgets.QGridLayout()
                              self.GD_ORIGINAL.setContentsMargins(9, 9, 9, 9)
                              self.GD_ORIGINAL.setSpacing(6)
                              self.GD_ORIGINAL.setObjectName("GD_ORIGINAL")
                              self.gridLayout = QtWidgets.QGridLayout()
                              self.gridLayout.setContentsMargins(9, 9, 9, 9)
                              self.gridLayout.setSpacing(6)
                              self.gridLayout.setObjectName("gridLayout")
                              self.TW_ORIGINAL = QtWidgets.QTableWidget(self.GB_ORIGINAL)
                              font = QtGui.QFont()
                              font.setFamily("Rockwell")
                              font.setPointSize(8)
                              self.TW_ORIGINAL.setFont(font)
                              self.TW_ORIGINAL.setFrameShape(QtWidgets.QFrame.StyledPanel)
                              self.TW_ORIGINAL.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
                              self.TW_ORIGINAL.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
                              self.TW_ORIGINAL.setRowCount(4)
                              self.TW_ORIGINAL.setColumnCount(2)
                              self.TW_ORIGINAL.setObjectName("TW_ORIGINAL")
                              self.TW_ORIGINAL.horizontalHeader().setVisible(False)
                              self.TW_ORIGINAL.horizontalHeader().setCascadingSectionResizes(True)
                              self.TW_ORIGINAL.horizontalHeader().setSortIndicatorShown(False)
                              self.TW_ORIGINAL.verticalHeader().setVisible(False)
                              self.TW_ORIGINAL.verticalHeader().setDefaultSectionSize(21)
                              self.gridLayout.addWidget(self.TW_ORIGINAL, 0, 0, 1, 2)
                              self.GD_ORIGINAL.addLayout(self.gridLayout, 3, 0, 1, 1)
                              self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
                              self.horizontalLayout_2.setContentsMargins(9, 9, 9, 9)
                              self.horizontalLayout_2.setSpacing(6)
                              self.horizontalLayout_2.setObjectName("horizontalLayout_2")
                              self.BT_OpenCAM = QtWidgets.QPushButton(self.GB_ORIGINAL)
                              icon1 = QtGui.QIcon()
                              icon1.addPixmap(QtGui.QPixmap(":/Webcam/resource/Hard/WEBCAM/CAM 04.ico"),
                                              QtGui.QIcon.Normal, QtGui.QIcon.Off)
                              self.BT_OpenCAM.setIcon(icon1)
                              self.BT_OpenCAM.setCheckable(True)
                              self.BT_OpenCAM.setObjectName("BT_OpenCAM")
                              self.horizontalLayout_2.addWidget(self.BT_OpenCAM)
                              self.BT_OpenFile = QtWidgets.QPushButton(self.GB_ORIGINAL)
                              icon2 = QtGui.QIcon()
                              icon2.addPixmap(QtGui.QPixmap(":/File/resource/File/FILE 032.ico"),
                                              QtGui.QIcon.Normal, QtGui.QIcon.Off)
                              self.BT_OpenFile.setIcon(icon2)
                              self.BT_OpenFile.setObjectName("BT_OpenFile")
                              self.horizontalLayout_2.addWidget(self.BT_OpenFile)
                              spacerItem = QtWidgets.QSpacerItem(
                                  93, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
                              self.horizontalLayout_2.addItem(spacerItem)
                              self.GD_ORIGINAL.addLayout(self.horizontalLayout_2, 0, 0, 1, 1)
                              self.LB_ORIGINAL = QtWidgets.QLabel(self.GB_ORIGINAL)
                              sizePolicy = QtWidgets.QSizePolicy(
                                  QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
                              sizePolicy.setHorizontalStretch(0)
                              sizePolicy.setVerticalStretch(0)
                              sizePolicy.setHeightForWidth(self.LB_ORIGINAL.sizePolicy().hasHeightForWidth())
                              self.LB_ORIGINAL.setSizePolicy(sizePolicy)
                              self.LB_ORIGINAL.setMinimumSize(QtCore.QSize(320, 240))
                              self.LB_ORIGINAL.setSizeIncrement(QtCore.QSize(0, 0))
                              self.LB_ORIGINAL.setBaseSize(QtCore.QSize(0, 0))
                              self.LB_ORIGINAL.setFrameShape(QtWidgets.QFrame.StyledPanel)
                              self.LB_ORIGINAL.setFrameShadow(QtWidgets.QFrame.Plain)
                              self.LB_ORIGINAL.setLineWidth(0)
                              self.LB_ORIGINAL.setMidLineWidth(0)
                              self.LB_ORIGINAL.setText("")
                              self.LB_ORIGINAL.setPixmap(QtGui.QPixmap(
                                  ":/No Image/resource/images/NO IMAGE/NO IMAGE 001.png"))
                              self.LB_ORIGINAL.setScaledContents(False)
                              self.LB_ORIGINAL.setAlignment(QtCore.Qt.AlignCenter)
                              self.LB_ORIGINAL.setObjectName("LB_ORIGINAL")
                              self.GD_ORIGINAL.addWidget(self.LB_ORIGINAL, 1, 0, 1, 1)
                              self.GL_ORIGINAL.addLayout(self.GD_ORIGINAL, 0, 0, 1, 1)
                              self.GD_WIDGET.addWidget(self.GB_ORIGINAL, 0, 0, 1, 1)
                              self.GB_WORK = QtWidgets.QGroupBox(self.centralwidget)
                              self.GB_WORK.setMinimumSize(QtCore.QSize(300, 0))
                              self.GB_WORK.setMouseTracking(False)
                              self.GB_WORK.setObjectName("GB_WORK")
                              self.GL_WORK = QtWidgets.QGridLayout(self.GB_WORK)
                              self.GL_WORK.setContentsMargins(9, 9, 9, 9)
                              self.GL_WORK.setSpacing(6)
                              self.GL_WORK.setObjectName("GL_WORK")
                              self.GD_WORK = QtWidgets.QGridLayout()
                              self.GD_WORK.setContentsMargins(9, 9, 9, 9)
                              self.GD_WORK.setSpacing(6)
                              self.GD_WORK.setObjectName("GD_WORK")
                              self.LB_WORK = mouse_over(self.GB_WORK)
                              sizePolicy = QtWidgets.QSizePolicy(
                                  QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
                              sizePolicy.setHorizontalStretch(0)
                              sizePolicy.setVerticalStretch(0)
                              sizePolicy.setHeightForWidth(self.LB_WORK.sizePolicy().hasHeightForWidth())
                              self.LB_WORK.setSizePolicy(sizePolicy)
                              self.LB_WORK.setMinimumSize(QtCore.QSize(320, 240))
                              self.LB_WORK.setSizeIncrement(QtCore.QSize(0, 0))
                              self.LB_WORK.setBaseSize(QtCore.QSize(0, 0))
                              self.LB_WORK.setMouseTracking(True)
                              self.LB_WORK.setFrameShape(QtWidgets.QFrame.StyledPanel)
                              self.LB_WORK.setFrameShadow(QtWidgets.QFrame.Plain)
                              self.LB_WORK.setText("")
                              self.LB_WORK.setPixmap(QtGui.QPixmap(
                                  ":/No Image/resource/images/NO IMAGE/NO IMAGE 001.png"))
                              self.LB_WORK.setAlignment(QtCore.Qt.AlignCenter)
                              self.LB_WORK.setObjectName("LB_WORK")
                              self.GD_WORK.addWidget(self.LB_WORK, 1, 0, 1, 1)
                              self.gridLayout_2 = QtWidgets.QGridLayout()
                              self.gridLayout_2.setContentsMargins(9, 9, 9, 9)
                              self.gridLayout_2.setSpacing(6)
                              self.gridLayout_2.setObjectName("gridLayout_2")
                              self.TW_WORK = QtWidgets.QTableWidget(self.GB_WORK)
                              font = QtGui.QFont()
                              font.setFamily("Rockwell")
                              font.setPointSize(8)
                              self.TW_WORK.setFont(font)
                              self.TW_WORK.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
                              self.TW_WORK.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
                              self.TW_WORK.setRowCount(4)
                              self.TW_WORK.setColumnCount(2)
                              self.TW_WORK.setObjectName("TW_WORK")
                              self.TW_WORK.horizontalHeader().setVisible(False)
                              self.TW_WORK.horizontalHeader().setCascadingSectionResizes(True)
                              self.TW_WORK.verticalHeader().setVisible(False)
                              self.TW_WORK.verticalHeader().setDefaultSectionSize(21)
                              self.gridLayout_2.addWidget(self.TW_WORK, 0, 0, 1, 2)
                              self.GD_WORK.addLayout(self.gridLayout_2, 3, 0, 1, 1)
                              self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
                              self.horizontalLayout_5.setContentsMargins(9, 9, 9, 9)
                              self.horizontalLayout_5.setSpacing(6)
                              self.horizontalLayout_5.setObjectName("horizontalLayout_5")
                              self.pushButton_2 = QtWidgets.QPushButton(self.GB_WORK)
                              self.pushButton_2.setObjectName("pushButton_2")
                              self.horizontalLayout_5.addWidget(self.pushButton_2)
                              self.comboBox = QtWidgets.QComboBox(self.GB_WORK)
                              self.comboBox.setMinimumSize(QtCore.QSize(150, 0))
                              self.comboBox.setObjectName("comboBox")
                              self.horizontalLayout_5.addWidget(self.comboBox)
                              spacerItem1 = QtWidgets.QSpacerItem(
                                  40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
                              self.horizontalLayout_5.addItem(spacerItem1)
                              self.GD_WORK.addLayout(self.horizontalLayout_5, 0, 0, 1, 1)
                              self.GL_WORK.addLayout(self.GD_WORK, 0, 0, 1, 1)
                              self.GD_WIDGET.addWidget(self.GB_WORK, 0, 1, 1, 1)
                              self.GB_BOTTOM = QtWidgets.QGroupBox(self.centralwidget)
                              sizePolicy = QtWidgets.QSizePolicy(
                                  QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
                              sizePolicy.setHorizontalStretch(0)
                              sizePolicy.setVerticalStretch(0)
                              sizePolicy.setHeightForWidth(self.GB_BOTTOM.sizePolicy().hasHeightForWidth())
                              self.GB_BOTTOM.setSizePolicy(sizePolicy)
                              self.GB_BOTTOM.setMinimumSize(QtCore.QSize(0, 70))
                              self.GB_BOTTOM.setMaximumSize(QtCore.QSize(16777215, 50))
                              font = QtGui.QFont()
                              font.setFamily("Rockwell")
                              font.setPointSize(8)
                              self.GB_BOTTOM.setFont(font)
                              self.GB_BOTTOM.setObjectName("GB_BOTTOM")
                              self.GL_BOTTOM = QtWidgets.QGridLayout(self.GB_BOTTOM)
                              self.GL_BOTTOM.setContentsMargins(2, 2, 2, 4)
                              self.GL_BOTTOM.setSpacing(2)
                              self.GL_BOTTOM.setObjectName("GL_BOTTOM")
                              self.GD_BOTTOM = QtWidgets.QGridLayout()
                              self.GD_BOTTOM.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
                              self.GD_BOTTOM.setContentsMargins(2, 2, 2, 2)
                              self.GD_BOTTOM.setHorizontalSpacing(3)
                              self.GD_BOTTOM.setVerticalSpacing(2)
                              self.GD_BOTTOM.setObjectName("GD_BOTTOM")
                              self.LB_RAM = QtWidgets.QLabel(self.GB_BOTTOM)
                              sizePolicy = QtWidgets.QSizePolicy(
                                  QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
                              sizePolicy.setHorizontalStretch(0)
                              sizePolicy.setVerticalStretch(0)
                              sizePolicy.setHeightForWidth(self.LB_RAM.sizePolicy().hasHeightForWidth())
                              self.LB_RAM.setSizePolicy(sizePolicy)
                              self.LB_RAM.setObjectName("LB_RAM")
                              self.GD_BOTTOM.addWidget(self.LB_RAM, 0, 2, 1, 1)
                              spacerItem2 = QtWidgets.QSpacerItem(
                                  600, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
                              self.GD_BOTTOM.addItem(spacerItem2, 0, 3, 1, 1)
                              self.LB_CPU = QtWidgets.QLabel(self.GB_BOTTOM)
                              sizePolicy = QtWidgets.QSizePolicy(
                                  QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
                              sizePolicy.setHorizontalStretch(0)
                              sizePolicy.setVerticalStretch(0)
                              sizePolicy.setHeightForWidth(self.LB_CPU.sizePolicy().hasHeightForWidth())
                              self.LB_CPU.setSizePolicy(sizePolicy)
                              self.LB_CPU.setObjectName("LB_CPU")
                              self.GD_BOTTOM.addWidget(self.LB_CPU, 0, 0, 1, 1)
                              self.LB_FREQ = QtWidgets.QLabel(self.GB_BOTTOM)
                              sizePolicy = QtWidgets.QSizePolicy(
                                  QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
                              sizePolicy.setHorizontalStretch(0)
                              sizePolicy.setVerticalStretch(0)
                              sizePolicy.setHeightForWidth(self.LB_FREQ.sizePolicy().hasHeightForWidth())
                              self.LB_FREQ.setSizePolicy(sizePolicy)
                              self.LB_FREQ.setObjectName("LB_FREQ")
                              self.GD_BOTTOM.addWidget(self.LB_FREQ, 0, 1, 1, 1)
                              self.GL_BOTTOM.addLayout(self.GD_BOTTOM, 0, 0, 1, 1)
                              self.GD_WIDGET.addWidget(self.GB_BOTTOM, 1, 0, 1, 2)
                              MainWindow.setCentralWidget(self.centralwidget)
                              self.menubar = QtWidgets.QMenuBar(MainWindow)
                              self.menubar.setGeometry(QtCore.QRect(0, 0, 835, 22))
                              self.menubar.setObjectName("menubar")
                              self.menuFile = QtWidgets.QMenu(self.menubar)
                              self.menuFile.setObjectName("menuFile")
                              self.menuCamera = QtWidgets.QMenu(self.menubar)
                              self.menuCamera.setObjectName("menuCamera")
                              self.menuInfo = QtWidgets.QMenu(self.menubar)
                              self.menuInfo.setObjectName("menuInfo")
                              MainWindow.setMenuBar(self.menubar)
                              self.statusbar = QtWidgets.QStatusBar(MainWindow)
                              self.statusbar.setEnabled(True)
                              sizePolicy = QtWidgets.QSizePolicy(
                                  QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Minimum)
                              sizePolicy.setHorizontalStretch(0)
                              sizePolicy.setVerticalStretch(0)
                              sizePolicy.setHeightForWidth(self.statusbar.sizePolicy().hasHeightForWidth())
                              self.statusbar.setSizePolicy(sizePolicy)
                              self.statusbar.setMinimumSize(QtCore.QSize(0, 0))
                              self.statusbar.setBaseSize(QtCore.QSize(0, 0))
                              self.statusbar.setObjectName("statusbar")
                              MainWindow.setStatusBar(self.statusbar)
                              self.actionExit = QtWidgets.QAction(MainWindow)
                              icon3 = QtGui.QIcon()
                              icon3.addPixmap(QtGui.QPixmap(":/Open Close/resource/Open close/EXIT 000.png"),
                                              QtGui.QIcon.Normal, QtGui.QIcon.Off)
                              self.actionExit.setIcon(icon3)
                              self.actionExit.setObjectName("actionExit")
                              self.CheckCam0 = QtWidgets.QAction(MainWindow)
                              self.CheckCam0.setCheckable(True)
                              self.CheckCam0.setChecked(True)
                              self.CheckCam0.setEnabled(True)
                              self.CheckCam0.setIcon(icon1)
                              self.CheckCam0.setObjectName("CheckCam0")
                              self.CheckCam1 = QtWidgets.QAction(MainWindow)
                              self.CheckCam1.setCheckable(True)
                              self.CheckCam1.setIcon(icon1)
                              self.CheckCam1.setObjectName("CheckCam1")
                              self.actionInfo = QtWidgets.QAction(MainWindow)
                              icon4 = QtGui.QIcon()
                              icon4.addPixmap(QtGui.QPixmap(":/Help/resource/Icon/HELP/HELP 000.ico"),
                                              QtGui.QIcon.Normal, QtGui.QIcon.Off)
                              self.actionInfo.setIcon(icon4)
                              self.actionInfo.setObjectName("actionInfo")
                              self.actionOpen_log_File = QtWidgets.QAction(MainWindow)
                              icon5 = QtGui.QIcon()
                              icon5.addPixmap(QtGui.QPixmap(":/File/resource/File/FILE 005.ico"),
                                              QtGui.QIcon.Normal, QtGui.QIcon.Off)
                              self.actionOpen_log_File.setIcon(icon5)
                              self.actionOpen_log_File.setObjectName("actionOpen_log_File")
                              self.menuFile.addAction(self.actionOpen_log_File)
                              self.menuFile.addSeparator()
                              self.menuFile.addAction(self.actionExit)
                              self.menuCamera.addAction(self.CheckCam0)
                              self.menuCamera.addAction(self.CheckCam1)
                              self.menuInfo.addAction(self.actionInfo)
                              self.menubar.addAction(self.menuFile.menuAction())
                              self.menubar.addAction(self.menuCamera.menuAction())
                              self.menubar.addAction(self.menuInfo.menuAction())
                      
                              self.retranslateUi(MainWindow)
                              QtCore.QMetaObject.connectSlotsByName(MainWindow)
                      
                          def retranslateUi(self, MainWindow):
                              _translate = QtCore.QCoreApplication.translate
                              MainWindow.setWindowTitle(_translate("MainWindow", "OpenCV"))
                              self.GB_ORIGINAL.setTitle(_translate("MainWindow", "Original"))
                              self.BT_OpenCAM.setText(_translate("MainWindow", "Open CAM"))
                              self.BT_OpenFile.setText(_translate("MainWindow", "Open File"))
                              self.GB_WORK.setTitle(_translate("MainWindow", "Work"))
                              self.pushButton_2.setText(_translate("MainWindow", "PushButton"))
                              self.GB_BOTTOM.setTitle(_translate("MainWindow", "Info"))
                              self.LB_RAM.setText(_translate("MainWindow", "RAM: 1000Mb"))
                              self.LB_CPU.setText(_translate("MainWindow", "CPU: 100%"))
                              self.LB_FREQ.setText(_translate("MainWindow", "1,000GHz"))
                              self.menuFile.setTitle(_translate("MainWindow", "File"))
                              self.menuCamera.setTitle(_translate("MainWindow", "Camera"))
                              self.menuInfo.setTitle(_translate("MainWindow", "Info"))
                              self.actionExit.setText(_translate("MainWindow", "Exit"))
                              self.CheckCam0.setText(_translate("MainWindow", "Select cam 1"))
                              self.CheckCam1.setText(_translate("MainWindow", "select cam 2"))
                              self.actionInfo.setText(_translate("MainWindow", "Info"))
                              self.actionOpen_log_File.setText(_translate("MainWindow", "Open log File"))
                      
                      
                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved