text color
This commit is contained in:
parent
24e55a9e62
commit
9feec8fe34
1 changed files with 13 additions and 0 deletions
|
@ -8,6 +8,8 @@ Created on 2018年1月30日
|
||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from PyQt5.QtCore import Qt
|
||||||
|
from PyQt5.QtGui import QTextCharFormat, QBrush, QColor
|
||||||
from PyQt5.QtWidgets import QApplication, QCalendarWidget
|
from PyQt5.QtWidgets import QApplication, QCalendarWidget
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,6 +111,17 @@ class CalendarWidget(QCalendarWidget):
|
||||||
# 隐藏左边的序号
|
# 隐藏左边的序号
|
||||||
self.setVerticalHeaderFormat(self.NoVerticalHeader)
|
self.setVerticalHeaderFormat(self.NoVerticalHeader)
|
||||||
|
|
||||||
|
# 修改周六周日颜色
|
||||||
|
|
||||||
|
fmtGreen = QTextCharFormat()
|
||||||
|
fmtGreen.setForeground(QBrush(Qt.green))
|
||||||
|
self.setWeekdayTextFormat(Qt.Saturday, fmtGreen)
|
||||||
|
|
||||||
|
fmtOrange = QTextCharFormat()
|
||||||
|
fmtOrange.setForeground(QBrush(QColor(252, 140, 28)))
|
||||||
|
self.setWeekdayTextFormat(Qt.Sunday, fmtOrange)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
app.setStyleSheet(StyleSheet)
|
app.setStyleSheet(StyleSheet)
|
||||||
|
|
Loading…
Reference in a new issue