1 year ago

#228454

test-img

user17750677

Text-decoration-color not working in python (pyqt5)

I am currently working on a little project with Pyqt5, and I'd like to underline a text (which is blue) in red. I have seen many topics that say it is necessary to use text-decoration-color but it is not working for me. Result : I have the text, underlined but underlined in blue and not in red. If someone had an idea, I would be really grateful. Here is my code :

class Window(QMainWindow):

    def __init__(self):
        super().__init__()
        self.setWindowTitle("Game")
        self.setGeometry(650,200,700,500)
        self.game()
        self.show()
        self.number = 0
    def game(self):
        title = QLabel("Choose a number", self)
        title.setGeometry(50, 10, 500, 100)
        font = QFont('Comic Sans MS', 17)
        title.setFont(font)
        title.setStyleSheet('QLabel {color: blue ; font-weight : bold ;'\
                'text-decoration : underline; text-decoration-color : red;}')

python

pyqt5

underline

text-decorations

0 Answers

Your Answer

Accepted video resources