PyQt触摸pixmap

时间:2017-03-25 21:56:05

标签: python qt pyqt

我有一张带有图片的表格,在这个例子中,它是一个湿度指示器,用户应该可以按下60%,10%和5%的点。标签应该显示按下的位置。

我该怎么做才能有人给我看一个例子,或者Qt不可能这样做?

我的代码(现在很空)

from PyQt5.QtWidgets import QApplication, QWidget, QDialog
from PyQt5.QtGui import QPixmap, QRegExpValidator
from PyQt5.QtCore import QRegExp
from mysql.connector import (connection)
from datetime import *
from bs4 import BeautifulSoup as bs
import os
import sys
import DatabaseHandling

'''Convert UI file to Python'''
os.chdir("C:\\Users\Gianni Declercq\AppData\Local\Programs\Python\Python36-32\Scripts")
os.system("pyuic5.exe M:\QtProjects\\Ui\RPI1_Third.ui -o M:\QtProjects\\RPI1_Third_ui.py")

from RPI1_Third_ui import Ui_Form3  # import after recreation of py file


class ThirdWindow(QWidget, Ui_Form3):
    def __init__(self):
        super(ThirdWindow, self).__init__()

        self.dbu = DatabaseHandling.DatabaseUtility()
        self.msl = None

        # Show UI on screen + resize window
        self.setupUi(self)
        self.picInidicator.setPixmap(QPixmap("F:\QtProjects\\138691.jpg"))
        self.setFixedSize(800, 480)


if __name__ == '__main__':
    app = QApplication([])
    window = ThirdWindow()
    window.show()
    sys.exit(app.exec_())

表单示例

Example form

0 个答案:

没有答案