VOOZH about

URL: https://www.geeksforgeeks.org/python/pyqt5-qcalendarwidget-background-color-to-the-year-spin-box/

⇱ PyQt5 QCalendarWidget - Background Color to the Year Spin Box - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

PyQt5 QCalendarWidget - Background Color to the Year Spin Box

Last Updated : 21 Jun, 2020
In this article we will see how we can set background color to the year spin box of the QCalendarWidget. In calendar in tool buttons there is a spin box to select the year, setting border to QCalendarWidget is not like setting background color to the other widgets, calendar is widget which has many child i.e component we can set background color to independent component as well. Below is how the calendar with background color on year spin box will look like 👁 Image
In order to do this we will use setStyleSheet method with the QCalendarWidget object, below is the style sheet code
QCalendarWidget QSpinBox
{
background-color : lightgreen;
}
Note : User can do similar action with the year spin box, that can be used with the normal spin box widget Below is the implementation Output :
Comment