Skip to content

Commit

Permalink
text color
Browse files Browse the repository at this point in the history
  • Loading branch information
892768447 committed Jan 26, 2019
1 parent 24e55a9 commit 9feec8f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions QCalendarWidget/CalendarQssStyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"""
import sys

from PyQt5.QtCore import Qt
from PyQt5.QtGui import QTextCharFormat, QBrush, QColor
from PyQt5.QtWidgets import QApplication, QCalendarWidget


Expand Down Expand Up @@ -109,6 +111,17 @@ def __init__(self, *args, **kwargs):
# 隐藏左边的序号
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__":
app = QApplication(sys.argv)
app.setStyleSheet(StyleSheet)
Expand Down

0 comments on commit 9feec8f

Please sign in to comment.