Transparent TextBrowser

Heads up! You've already completed this tutorial.

s05680089926 | 2021-02-12 12:01:34 UTC | #1

Hello everyone, I got a tricky question. I am pretty new to pyqt5. I build an object detection and everytime something gets detected i append a text to an textbrowser widget.

How I want that the last append appears with higher transparency than the apended text before. Any idea how to achieve that? Thanks in advance


martin | 2021-02-12 21:32:57 UTC | #2

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 https://www.pythonguis.com/tutorials/modelview-architecture/ ) and apply conditional formatting to the last element in the list. That way the appeance will be handled automatically.


s05680089926 | 2021-02-13 08:52:12 UTC | #3

I want to generate a fading out Effekt with the already appended text.


Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak