import sys
from PyQt5.QtCore import Qt, QTimer, QDateTime, QDate
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import (QApplication, QWidget, QDialog, QPushButton, QTextEdit,
QGroupBox, QCheckBox, QRadioButton, QComboBox, QLabel,
QVBoxLayout, QHBoxLayout, QGridLayout, QStyleFactory,
QTabWidget, QSizePolicy, QProgressBar, QTableWidget,
QLineEdit, QSpinBox, QDateTimeEdit, QSlider,
QScrollBar, QDial, QCalendarWidget)
# 标记控制窗口
class WindowStyleDemo(QDialog):
def __init__(self):
super(WindowStyleDemo, self).__init__()
# 设置窗口标题
self.setWindowTitle('实战PyQt5: 应用显示风格演示')
# 应用的初始调色板
self.origPalette = QApplication.palette()
self.initUi()
def initUi(self):
styleComboBox = QComboBox()
styleKeys = QStyleFactory.keys()
print(styleKeys)
# 添加系统内建的显示风格
styleComboBox.addItems(styleKeys)
# 最顶端显示控制部分
styleLabel = QLabel('显示风格(&S):')
styleLabel.setBuddy(styleComboBox)
self.chkUseStylePalette = QCheckBox('使用标准调色板(&U)')
self.chkUseStylePalette.setChecked(True)
chkDisableWidgets = QCheckBox('禁用控件(&D)')
# 生成要显示的部件
self.createTopLeftGroupBox()
self.createTopRightGroupBox()
self.createBottomLeftTabWidget()
self.createBottomRightGroupBox()
self.createProgressBar()
styleComboBox.activated[str].connect(self.changeStyle)
self.chkUseStylePalette.toggled.connect(self.changePalette)
chkDisableWidgets.toggled.connect(sel
pyqt设置风格
最新推荐文章于 2024-07-04 00:00:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)