Q: Changing Text-Color in Text-Widget? 
Author Message
 Q: Changing Text-Color in Text-Widget?

Hi,

i opened (like in tktail-example in chapter 18.1 of the faq) a text-widget
with

    $t = $mw->Text(-width => 80, -height => 25, -wrap => 'none');
    $t->pack(-expand => 1);

and i write text to it with

    $widget->insert('end', $ARG);
    $widget->yview('end');

Everything works fine, but now i want to change the color of the text. Not
the color of all the text, but different colors for different words (sort
of a syntax-highlighting). I tried to insert ansi-colorcodes, but that
didn't work.

How can that be done?

--

        -kk-           http://www.*-*-*.com/



Sat, 05 May 2001 03:00:00 GMT  
 Q: Changing Text-Color in Text-Widget?
: Everything works fine, but now i want to change the color of the text. Not
: the color of all the text, but different colors for different words (sort
: of a syntax-highlighting). I tried to insert ansi-colorcodes, but that
: didn't work.

: How can that be done?

By defining some tags, configuring them with the appropriate foreground
and background colors, and applying them to text as you insert it.  Take
a look at the code for a couple of the "widget tour" examples as they do
this.



Sat, 05 May 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Color Changes in Text widget

2. Text widget - change background color at insertcursor

3. Color Coding Text in a Tk::Text Widget

4. Colors in Text widget and select colors

5. color in the text widget

6. Coloring tags in text widget

7. Changing cursor color in text box?

8. color of insertion cursor in text widgets

9. Text color in my scrolled->Listbox widget

10. how to use different colors in same line in text widget

11. Text widget and colors

12. change background color on a widget when the textvariable changes

 

 
Powered by phpBB® Forum Software