How to change vertical scroll color in QScrollBar ?
1 answer
Use Qt (stylesheet) styles , for example:
from PyQt5.QtWidgets import * if __name__ == '__main__': app = QApplication([]) w = QListWidget() w.addItems(['item #{}'.format(_) for _ in range(100)]) w.setStyleSheet(""" QScrollBar:vertical { border: 2px solid grey; background: #32CC99; } """) w.show() app.exec() It looks like this:
If you want to apply a style to all widgets, then the setStyleSheet method setStyleSheet called on the QApplication object.
- @fangry, better create a separate question, your comment is no longer on the topic, and the code in it does not look normal;) - gil9red
- Created [ en.stackoverflow.com/questions/658322/… - user222349
- I can not understand why the style is not applied, I did everything as you wrote, but nothing has changed screen - user222349
- @fangry, does my code work for you? - gil9red
- Yes, everything works as you have on the screen - user222349
|

