锋哥原创的PyQt6视频教程:
2024版 PyQt6 Python桌面开发 视频教程(无废话版) 玩命更新中~_哔哩哔哩_bilibili2024版 PyQt6 Python桌面开发 视频教程(无废话版) 玩命更新中~共计29条视频,包括:2024版 PyQt6 Python桌面开发 视频教程(无废话版) 玩命更新中~、第2讲 PyQt6库和工具库QTDesigner安装与配置、第3讲 PyQt6第一个程序HelloWorld实现等,UP主更多精彩视频,请关注UP账号。https://www.bilibili.com/video/BV11C4y1P7fj/
QLCDNumber控件主要用来显示液晶数字。
QLCDNumber类的常用方法如下:
方法 | 描述 |
---|---|
setDigitCount() | 设置可以显示的数字数量 |
setSmallDecimalPoint() | 是否有小数点,如果有小数点,就可以显示小数。 |
setMode() | 设置显示数字的模式,有4种模式:Bin(二进制)、Oct(八进制)、Dec(十进制)、Hex(十六进制) |
setSegmentStyle() | 设置显示样式,有3种样式:OutLine、Filled和Flat |
value() | 获取显示的数值 |
生成的参考代码:
# Form implementation generated from reading ui file 'QLCDNumber液晶数字显示控件.ui'
#
# Created by: PyQt6 UI code generator 6.4.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(400, 300)
self.lcdNumber = QtWidgets.QLCDNumber(parent=Form)
self.lcdNumber.setGeometry(QtCore.QRect(140, 80, 131, 81))
self.lcdNumber.setSmallDecimalPoint(False)
self.lcdNumber.setMode(QtWidgets.QLCDNumber.Mode.Dec)
self.lcdNumber.setSegmentStyle(QtWidgets.QLCDNumber.SegmentStyle.Flat)
self.lcdNumber.setProperty("value", 3.011)
self.lcdNumber.setObjectName("lcdNumber")
self.lcdNumber_2 = QtWidgets.QLCDNumber(parent=Form)
self.lcdNumber_2.setGeometry(QtCore.QRect(140, 190, 131, 81))
self.lcdNumber_2.setSmallDecimalPoint(False)
self.lcdNumber_2.setMode(QtWidgets.QLCDNumber.Mode.Dec)
self.lcdNumber_2.setSegmentStyle(QtWidgets.QLCDNumber.SegmentStyle.Flat)
self.lcdNumber_2.setProperty("value", 3.011)
self.lcdNumber_2.setProperty("intValue", 3)
self.lcdNumber_2.setObjectName("lcdNumber_2")
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))