When you say transparency, do you mean in a lighter colour, or is your text box actually transparent? Normally, the back of windows in Qt are filled in (although you can turn this off!)
If you’re using QTextEdit
you can use .setTextColor
to set the color of the text, although for the effect you’re after you’d have to reset the previous line back to the normal color too.
What I think I would do instead, is use a QListView
(see model views Using the PyQt5 ModelView Architecture to build a simple Todo app — Hands-on guide to Python GUI programming with Qt ) and apply conditional formatting to the last element in the list. That way the appeance will be handled automatically.