Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 pyQt5 QCalendarWidget setHeaderTextFormat
#1
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.


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_())

İmage
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Huge code problems (buttons(PyQt5),PyQt5 Threads, Windows etc) ZenWoR 0 102 Apr-06-2019, 11:15 PM
Last Post: ZenWoR
  [Pyqt5]Display name of new inserted USB stick on GUI Atalanttore 0 149 Mar-24-2019, 08:29 PM
Last Post: Atalanttore
  Python3/PyQt5/gnuplot on linux erg 1 134 Mar-20-2019, 01:57 PM
Last Post: Axel_Erfurt
  How to show graph as a slideshow in PyQt5 using matplotlib binsha 0 236 Mar-08-2019, 03:58 AM
Last Post: binsha
  TypeError when using PushButton (PyQt5) lmsavk 1 149 Mar-03-2019, 04:21 PM
Last Post: Alfalfa
  [PyQt] pyqt5 comobox insert into mysql Weballround 2 316 Jan-11-2019, 05:56 AM
Last Post: Weballround
  [PyQt] I get the error when I try to open the sample Why can pyqt5 installed onatdogan 3 317 Dec-25-2018, 03:00 PM
Last Post: Larz60+
  pyqt5 combobox add item with loop shift838 5 671 Dec-09-2018, 08:54 PM
Last Post: shift838
  PyQT5 - connect to mouseMoveEvent kainev 0 393 Nov-28-2018, 02:14 PM
Last Post: kainev
  Missing characters in PyQt5 LittleGrim13 2 346 Nov-28-2018, 06:48 AM
Last Post: LittleGrim13

Forum Jump:


Users browsing this thread: 1 Guest(s)