Apr-14-2019, 11:50 PM
As written displays widget with a black background (what I want) except for the outer frame and the horizontal header. want to make the entire widget with black background. I cannot get the syntax right. Any suggestions? Thank you.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QDialog, QVBoxLayout, QCalendarWidget, QLabel import sys from PyQt5 import QtGui from PyQt5.QtCore import Qt, pyqtSlot from PyQt5.QtGui import QTextCharFormat, QBrush, QColor, QTextFormat class Window(QDialog): def __init__( self ): super ().__init__() self .left = 700 self .top = 500 self .width = 100 self .height = 75 self .setGeometry( self .left, self .top, self .width, self .height) self .setWindowFlags(Qt.FramelessWindowHint) self .Calendar() self .show() def Calendar( self ): vbox = QVBoxLayout() format = QTextCharFormat() self .calendar = QCalendarWidget() self .calendar.setHorizontalHeaderFormat(QCalendarWidget.SingleLetterDayNames) self .calendar.setVerticalHeaderFormat(QCalendarWidget.NoVerticalHeader) # self.calendar.setHeaderTextFormat(format.setBackground(Qt.black)) self .calendar.setSelectionMode(QCalendarWidget.NoSelection) self .calendar.setStyleSheet( "background-color: black; color: rgba(162, 201, 229, 255); " ) vbox.addWidget( self .calendar) self .setLayout(vbox) if __name__ = = '__main__' : app = QApplication(sys.argv) window = Window() sys.exit(app.exec_()) |
