Prev: namespace unknown not quite what I expected
Next: Active State base-tcl8 vfs::ftp Error can't find package ftp
From: James Littlefield on 24 Feb 2010 21:00 I need to change the foreground (or background) color to highlight only specific words in a scrollable text widget. Is there a way to embed formatting control codes (sort of like ansi escape codes) in the content of a text widget to cause this? Thanks Jim --- news://freenews.netfront.net/ - complaints: news(a)netfront.net ---
From: APN on 24 Feb 2010 23:13 You can tag the range of characters/words and then use the -foreground option on the tag. Read up the Tags section in the text widget man page. /Ashok On Feb 25, 7:00 am, James Littlefield <jameslittlefi...(a)verizon.net> wrote: > I need to change the foreground (or background) color to highlight only > specific words in a scrollable text widget. Is there a way to embed > formatting control codes (sort of like ansi escape codes) in the content > of a text widget to cause this? > > Thanks > Jim > > --- news://freenews.netfront.net/ - complaints: n...(a)netfront.net ---
From: Jeff Godfrey on 24 Feb 2010 23:15 James Littlefield wrote: > I need to change the foreground (or background) color to highlight only > specific words in a scrollable text widget. Is there a way to embed > formatting control codes (sort of like ansi escape codes) in the content > of a text widget to cause this? > > Thanks > Jim > > --- news://freenews.netfront.net/ - complaints: news(a)netfront.net --- Hi Jim, You'll want to look at the text widget's tagging ability. Basically, you create tags, apply your formatting to the tags, and then apply the tags to specific character ranges in the text widget. Jeff
From: suchenwi on 25 Feb 2010 04:11 On 25 Feb., 05:15, Jeff Godfrey <jeff_godf...(a)pobox.com> wrote: > James Littlefield wrote: > > I need to change the foreground (or background) color to highlight only > > specific words in a scrollable text widget. Is there a way to embed > > formatting control codes (sort of like ansi escape codes) in the content > > of a text widget to cause this? > You'll want to look at the text widget's tagging ability. Basically, > you create tags, apply your formatting to the tags, and then apply the > tags to specific character ranges in the text widget. Simple example, in an interactive wish: % pack [text .t] % foreach i {red green blue} {.t tag configure $i -foreground $i} % .t insert end "hello, " red world! green
From: Arjen Markus on 25 Feb 2010 05:45 On 25 feb, 03:00, James Littlefield <jameslittlefi...(a)verizon.net> wrote: > I need to change the foreground (or background) color to highlight only > specific words in a scrollable text widget. Is there a way to embed > formatting control codes (sort of like ansi escape codes) in the content > of a text widget to cause this? > > Thanks > Jim > > --- news://freenews.netfront.net/ - complaints: n...(a)netfront.net --- You may also want to look at the ctext package in Tklib. This automates a lot of such tasks for you. It is geared at syntax highlighting though, so it is at its best with regular expressions. As for formatting codes: you could use the -elide option for tags to hide the actual code from the display while analysing your input text. Regards, Arjen
|
Next
|
Last
Pages: 1 2 Prev: namespace unknown not quite what I expected Next: Active State base-tcl8 vfs::ftp Error can't find package ftp |