#๐Ÿ”’ Color of widget affecting scrollbar

32 messages ยท Page 1 of 1 (latest)

copper birchBOT
#

@hoary nest

Python help channel opened

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.

hoary nest
#

Second one is after I changed the color of the main widget.

void juniper
#

How are you changing the colour?

hoary nest
#

SetStyleSheet

void juniper
#

are you specifying the widget type you want to colour?

#
wdg = QtWidgets.QWidget()
wdg.setStyleSheet('background-color: red;')
hoary nest
void juniper
#

if you do something like this, it will colour the widget and all of its children

hoary nest
#

which it did

#

although it seems with a negative affect i want to avoid, (messing with the scrollbar)

void juniper
#

if you remove the stylesheet, the scrollbar changes back?

void juniper
#

that's odd

#

are you using a dark theme plugin or something?

hoary nest
#

does this sound right to you?

void juniper
#

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

hoary nest
#

Yeah....

void juniper
#

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

void juniper
#

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

hoary nest
#

Thanks, problem resolved

copper birchBOT
#
Python help channel closed using Discord native close action

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.