控件24"/>
[PyQt5]基本控件24
文章目录
- PyQt5系列文章
- 效果图
- 完整代码
PyQt5系列文章
基本控件 | - | - | - |
---|---|---|---|
1.按钮QPushButton | 2.标签QLabel | 3.可编辑框QTextEdit | 4.文本提示QToolTip |
5.单行输入框QLineEdit | 6.消息框QMessageBox | 7.单选按钮QRadioButton | 8.下拉列表QComboBox |
9.图片显示QPixmap | 10.分组框QGroupBox | 11.进度条QProgressBar | 12.对话框QDialog |
13.进度条对话框QProgressDialog | 14.复选框QCheckBox | 15.滑块QSlider | 16.状态栏QStatusBar |
17.文件对话框QFileDialog | 18.工具栏QToolBar | 19.分割条QSplitter | 20.菜单栏QMenuBar |
21.滚动条QScrollBar | 22.时间编辑框QTimeEdit | 23.日期编辑框QDateEdit | 24.时间日期编辑框QDateTimeEdit |
高级控件 | - | - | - |
---|---|---|---|
1.列表控件QListWidget | 2.表格控件QTableWidget | 3.树形控件QTreeWidget | 4.选项卡QTabWidget |
5.浮动窗口QDockWidget | 6.堆叠窗口QStackedWidget | 7.堆叠布局QStackedLayout | 8.网格布局QGridLayout |
9.表单布局QFormLayout | 10.水平布局QHBoxLayout | 11.垂直布局QVBoxLayout | 12.日历QCalendarWidget |
13.线程QThread | 14.定时器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
发布评论