[PyQt5]基本控件24

编程入门 行业动态 更新时间:2024-10-28 12:26:27

[PyQt5]基本<a href=https://www.elefans.com/category/jswz/34/1769529.html style=控件24"/>

[PyQt5]基本控件24

文章目录

  • PyQt5系列文章
  • 效果图
  • 完整代码

PyQt5系列文章

基本控件---
1.按钮QPushButton2.标签QLabel3.可编辑框QTextEdit4.文本提示QToolTip
5.单行输入框QLineEdit6.消息框QMessageBox7.单选按钮QRadioButton8.下拉列表QComboBox
9.图片显示QPixmap10.分组框QGroupBox11.进度条QProgressBar12.对话框QDialog
13.进度条对话框QProgressDialog14.复选框QCheckBox15.滑块QSlider16.状态栏QStatusBar
17.文件对话框QFileDialog18.工具栏QToolBar19.分割条QSplitter20.菜单栏QMenuBar
21.滚动条QScrollBar22.时间编辑框QTimeEdit23.日期编辑框QDateEdit24.时间日期编辑框QDateTimeEdit
高级控件---
1.列表控件QListWidget2.表格控件QTableWidget3.树形控件QTreeWidget4.选项卡QTabWidget
5.浮动窗口QDockWidget6.堆叠窗口QStackedWidget7.堆叠布局QStackedLayout8.网格布局QGridLayout
9.表单布局QFormLayout10.水平布局QHBoxLayout11.垂直布局QVBoxLayout12.日历QCalendarWidget
13.线程QThread14.定时器QTimer--

效果图

完整代码

import sys
from PyQt5.QtWidgets import QDateTimeEdit,QVBoxLayout,QWidget,QApplication,QMainWindow
from PyQt5.QtCore import QDateTime,QDate,QTimeclass QDateTimeEditDemo(QMainWindow):def __init__(self):super(QDateTimeEditDemo, self).__init__()#设置窗口大小self.resize(400, 150)self.setWindowTitle("QDateTimeEditDemo")dateTimeEdit = QDateTimeEdit(QDateTime.currentDateTime(), self)dateEdit = QDateTimeEdit(QDate.currentDate(), self)timeEdit = QDateTimeEdit(QTime.currentTime(), self)dateTimeEdit.setDisplayFormat("yyyy-MM-dd HH:mm:ss")dateEdit.setDisplayFormat("yyyy.MM.dd")timeEdit.setDisplayFormat("HH:mm:ss")#创建水平布局layout = QVBoxLayout()layout.addWidget(dateTimeEdit)layout.addWidget(dateEdit)layout.addWidget(timeEdit)mainFrame = QWidget()mainFrame.setLayout(layout)self.setCentralWidget(mainFrame)if  __name__ == '__main__':app = QApplication(sys.argv)main = QDateTimeEditDemo()main.show()sys.exit(app.exec_())

更多推荐

[PyQt5]基本控件24

本文发布于:2023-06-20 12:19:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/801387.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!