PDA

View Full Version : print one part of a string in blue



dennisvz
19th June 2018, 01:05
I am trying to make one word (filestatus) in the string below show in blue. I have:



filestatus = "MARRIED, JOINT"

self.ui.title.setText(str("My Tax Info Based on a Filing Status of: " + filestatus.format('color=blue')))



I get no errors but it does not work

thanks

d_stranz
19th June 2018, 16:33
Try formatting your text using Rich Text Format HTML (RTF) (https://doc.qt.io/qt-5/richtext-html-subset.html). You'll have to use CSS to insert the color attribute into the HTML string.