#๐ Color of widget affecting scrollbar
32 messages ยท Page 1 of 1 (latest)
@hoary nest
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Second one is after I changed the color of the main widget.
How are you changing the colour?
SetStyleSheet
are you specifying the widget type you want to colour?
wdg = QtWidgets.QWidget()
wdg.setStyleSheet('background-color: red;')
self.app_widget.setStyleSheet("background-color: #303030;")
if you do something like this, it will colour the widget and all of its children
Yeah i want it to
which it did
although it seems with a negative affect i want to avoid, (messing with the scrollbar)
if you remove the stylesheet, the scrollbar changes back?
just default microsoft dark mode
does this sound right to you?
Yes, default colours are set with palettes, not stylesheets
you can change the colour by setting the QPalette but you can't also use this with stylesheets
I usually use qpalette for qwidget
because I don't really care about any other stylesheet edits on a qwidget
but something like buttons, I might want more control over hover/press or rounded corners, so I use css for that
yeah gotcha
you need to make sure you use setAutoFillBackground to True on those widgets as well
unless it's your base widget, qwidget doesn't display its background through a palette
thats good to knw
know*
Thanks, problem resolved
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.
