PyQt6 QTimeEdit时间控件

​锋哥原创的PyQt6视频教程:

2024版 PyQt6 Python桌面开发 视频教程(无废话版) 玩命更新中~_哔哩哔哩_bilibili2024版 PyQt6 Python桌面开发 视频教程(无废话版) 玩命更新中~共计39条视频,包括:2024版 PyQt6 Python桌面开发 视频教程(无废话版) 玩命更新中~、第2讲 PyQt6库和工具库QTDesigner安装与配置、第3讲 PyQt6第一个程序HelloWorld实现等,UP主更多精彩视频,请关注UP账号。https://www.bilibili.com/video/BV11C4y1P7fj/

QTimeEdit是单纯的时间控件,继承QDateTimeEdit,拥有QDateTimeEdit的所有属性和方法。

UI生成参考代码:

python 复制代码
from PyQt6 import QtCore, QtGui, QtWidgets


class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(400, 300)
        self.timeEdit = QtWidgets.QTimeEdit(parent=Form)
        self.timeEdit.setGeometry(QtCore.QRect(140, 130, 118, 22))
        self.timeEdit.setCalendarPopup(False)
        self.timeEdit.setTime(QtCore.QTime(10, 22, 44))
        self.timeEdit.setObjectName("timeEdit")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        _translate = QtCore.QCoreApplication.translate
        Form.setWindowTitle(_translate("Form", "Form"))
        self.timeEdit.setDisplayFormat(_translate("Form", "HH:mm:ss"))
相关推荐
czhc1140075663几秒前
Linux 76 rsync
linux·运维·python
悠悠小茉莉31 分钟前
Win11 安装 Visual Studio(保姆教程 - 更新至2025.07)
c++·ide·vscode·python·visualstudio·visual studio
m0_625686551 小时前
day53
python
Real_man1 小时前
告别 requirements.txt,拥抱 pyproject.toml和uv的现代Python工作流
python
站大爷IP2 小时前
Python文件操作的"保险箱":with语句深度实战指南
python
运器1232 小时前
【一起来学AI大模型】算法核心:数组/哈希表/树/排序/动态规划(LeetCode精练)
开发语言·人工智能·python·算法·ai·散列表·ai编程
巴里巴气4 小时前
selenium基础知识 和 模拟登录selenium版本
爬虫·python·selenium·爬虫模拟登录
19894 小时前
【零基础学AI】第26讲:循环神经网络(RNN)与LSTM - 文本生成
人工智能·python·rnn·神经网络·机器学习·tensorflow·lstm
JavaEdge在掘金5 小时前
Redis 数据倾斜?别慌!从成因到解决方案,一文帮你搞定
python
ansurfen5 小时前
我的第一个AI项目:从零搭建RAG知识库的踩坑之旅
python·llm