There are a few things wrong with the stylesheet syntax you are using.
Firstly, ID
selectors (i.e. #nom_plan_label
) must refer to the objectName
of the widget.
Secondly, it is only necessary to use selectors when a stylesheet is applied to an ancestor widget and you want certain style rules to cascade down to particular descendant widgets. If you're applying the stylesheet directly to one widget, the selector (and braces) can be left out.
Given the above two points, your example code would become either:
nom_plan_label = QtGui.QLabel()
nom_plan_label.setText(nom_plan_vignette)
nom_plan_label.setObjectName('nom_plan_label')
nom_plan_label.setStyleSheet('QLabel#nom_plan_label {color: yellow}')
or, more simply:
nom_plan_label = QtGui.QLabel()
nom_plan_label.setText(nom_plan_vignette)
nom_plan_label.setStyleSheet('color: yellow')