[PyKDE] QTextEdit/LogText color question

Vio vmilitaru at sympatico.ca
Sat May 31 19:47:01 BST 2003


How about:

my_favorite_color = QColor(11,22,33) # change to real color values
my_textedit_widget.setPaletteForegroundColor(my_favorite_color)

Hope this helps,
Vio


Sundance wrote:

>Hello people,
>
>I'm seeking to use the LogText kind of QTextEdit. I want to set the 
>*default* text color in that widget. So far I've been unsuccessful.
>
>I've tried to use my_textedit_widget.setColor(). Doesn't work.
>
>So I've begun exploring the whole stylesheeting system, to no avail so 
>far. I have a feeling that the solution to my problem could be as 
>simple as:
>  my_textedit_widget.styleSheet().item(*default item*).setColor()
>But I have no idea what '*default item*' should be. "qt" didn't work. 
>"html" didn't work. "body" didn't work. "font" didn't work. "" (empty 
>string) didn't work. Gah! In all cases, the text remained black.
>
>I suppose that printing '<font color="what_i_want_at_the_time">' in my 
>widget's text right at creation time, and leaving this tag unclosed for 
>the time being, would do it. But it feels awfully kludgy to me. I'm 
>sure I'm missing the 'right' way to do it.
>
>Does anyone have any clue about what that 'right' way would be? Thanks 
>in advance!
>
>-- S.
>
>_______________________________________________
>PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
>http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
>
>  
>






More information about the PyQt mailing list