• 大小: 16KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-28
  • 语言: Python
  • 标签: python  pyqt  

资源简介

python+pyqt5绘图,显示图像,播放视频的图形界面程序

资源截图

代码片段和文件信息

# -*- coding: utf-8 -*-
from gui_demo_ui import Ui_Form
from PyQt5.QtWidgets import QWidget QFileDialog
from PyQt5.QtCore import QTimer
import cv2
import numpy as np
from matplotlib.patches import Rectangle
import time
import os

class demoWindows(QWidget):
    def __del__(self):
        self.camera.release()# 释放资源
        if self.out_release_flag:
            self.out.release()

    def init_fun(self):
        self.window = Ui_Form()
        self.window.setupUi(self)
        self.showandhideframe()
        self.timer = QTimer()# 定义一个定时器对象
        self.timer.timeout.connect(self.timer_fun) #计时结束调用方法

        self.window.pushButton_2.clicked.connect(self.timer_start)# 这几行就是绑定按键的处理事件
        self.window.pushButton_3.clicked.connect(self.recod_image)
        self.window.pushButton_4.clicked.connect(self.timer_stop)
        self.window.pushButton_5.clicked.connect(self.outfilespath_fun)
        self.out_release_flag = False
        self.tmp_img = np.zeros((72010803) np.uint8)
        self.window.comboBox_type.currentIndexChanged.connect(self.showandhideframe)
        self.window.OK_Btn.clicked.connect(self.draw_lines_fun)
        self.window.pushButton.clicked.connect(self.open_btn_fun)

        self.window.figure1.canvas.mpl_connect(“button_press_event“ self.figure1_on_press)# 绑定鼠标按下事件
        self.window.figure1.canvas.mpl_connect(“button_release_event“ self.figure1_on_release)# 绑定鼠标松下按键

    ‘‘‘
    showandhideframe():这个函数使用来根据选择绘制类型进行显示对应的参数
    ‘‘‘
    def showandhideframe(self):
        if self.window.comboBox_type.currentText() == “直线“:
            self.window.frame_line_range.show()
            self.window.frame_yuan.hide()
            self.window.frame_tuoyuan.hide()
            self.window.frame_wenzi.hide()
            # print(self.comboBox_type.currentText())
        elif self.window.comboBox_type.currentText() == “矩形“:
            self.window.frame_line_range.show()
            self.window.frame_yuan.hide()
            self.window.frame_tuoyuan.hide()
            self.window.frame_wenzi.hide()
        elif self.window.comboBox_type.currentText() == “圆“:
            self.window.frame_line_range.hide()
            self.window.frame_yuan.show()
            self.window.frame_tuoyuan.hide()
            self.window.frame_wenzi.hide()
        elif self.window.comboBox_type.currentText() == “椭圆“:
            self.window.frame_line_range.hide()
            self.window.frame_yuan.hide()
            self.window.frame_tuoyuan.show()
            self.window.frame_wenzi.hide()
        elif self.window.comboBox_type.currentText() == “文字“:
            self.window.frame_line_range.hide()
            self.window.frame_yuan.hide()
            self.window.frame_tuoyuan.hide()
            self.window.frame_wenzi.show()
        else:
            # print(self.comboBox_type.currentText())
            self.window.frame_line_range.hide()
            self.window.frame_yuan.hide()
         

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-10-08 21:55  chat\__pycache__\
     文件       13670  2018-10-08 21:37  chat\__pycache__\gui_demo_ui.cpython-36.pyc
     文件       46909  2018-10-08 21:37  chat\gui_demo.ui
     文件       10886  2018-10-08 22:50  chat\gui_demo_fun.py
     文件       31414  2018-10-08 21:37  chat\gui_demo_ui.py
     目录           0  2019-01-09 11:22  chat\

评论

共有 条评论