Re: Underlining text on canvas
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: Underlining text on canvas

From: Helmut Giese <hgiese@ratiosoft.com>
Date: Fri Dec 30 2005 - 23:05:53 CET

On 30 Dec 2005 12:36:19 -0800, "bluetit" <capricious.falcon@gmail.com>
wrote:

>Given a text tag on a canvas, I would like to underline one letter in
>that text... using font measure to get it's start and end point and
>then drawing a line with those coords doesn't do a good job (line does
>not evenly underline the character, with some characters it's to the
>right more, with others to the left more).
Hi Tom,
the tags of the text widget have an underline option which you could
use like
        ---
pack [text .t]
.t tag configure ul -underline 1
.t insert end "Some "
# "tag" any text you want
.t insert end "T" ul
.t insert end "ext"
        ---
Uups, re-reading your post I just notice that you are talking of a
text item on a canvas. Now, the canvas supports the tagging mechanism
as well, but I don't know if 'underline' is available for its text
items.

HTH nonetheless
Helmut Giese
Received on Tue Jan 3 03:09:51 2006