In my application, the user clicks on any widget of my program (which is inactive at that time) and selects a color for it.
This color will be added to the stylesheet for this particular widget.
However, when the program ends and starts again, I would like this particular widget to retain its stylesheet.
I would like there to be no hard code in the style sheets for each widget. In fact, I would not even know which particular widget has a stylesheet.
I would really like for me to have one stylesheet for the application, as well as a new color code only for the selected widget.
(ie if the user clicked the QPushButton button and selects the style sheet {color: red},
I would like it to be just QPushButton, and no one else.
So, if this QPushButton has the variable name "Clicky",
in the QApplications stylesheet, I would add:
'QPushButton # Clicky {color: red}')
To do this and donβt need to hardcode it for each widget,
I have to somehow convert the variable name of my PyQt4 widgets to strings.
How can i do this?
Thanks!
(I read that getting python variable names from their values ββis very difficult.
Is there any other form of identifier for the widget that can be added to the stylesheet?)
PyQt4
python 2.7.2
Windows 7
variables qt pyqt pyqt4
Anti earth
source share