setStylesheet - get colour from default scheme

Heads up! You've already completed this tutorial.

Rafael_Lago | 2020-11-24 10:33:01 UTC | #1

So, I am trying to change the background colour of one Widget to a "default" colour, something like:

self.setStyleSheet("QLineEdit { background: \<alternate-row-background-colour> ; }")

I don't want to hard-code a colour of "my choice" inside of the code, because if the user changes the his/hers colour scheme, the "my colour" could just look weird or even unreadable.

Is there any set of "default" colours, provided by the chosen colour scheme?


Packaging Python Applications with PyInstaller by Martin Fitzpatrick — This step-by-step guide walks you through packaging your own Python applications from simple examples to complete installers and signed executables.

More info Get the book

Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak
Martin Fitzpatrick

setStylesheet - get colour from default scheme was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt. Martin founded PythonGUIs to provide easy to follow GUI programming tutorials to the Python community. He has written a number of popular https://www.martinfitzpatrick.com/browse/books/ on the subject.