Re: How to retrieve a text string information
- From: "Jeff Godfrey" <jeff_godfrey@xxxxxxxxx>
- Date: Sun, 16 Jul 2006 04:21:01 GMT
<maura.monville@xxxxxxxxx> wrote in message
news:1153021120.776205.269810@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
It's a great idea but I forsee three possible obstacles at
implementing it.
1. Users can place any number of such text strings at will. May I
tag
all these text strings the same way (using the same tag) ?
Sure. In fact, that's a very common use for tags (tagging "common"
items with a "common" tag).
2. Is this possible by retrieving the text strings through their
common
tag ?
3. Should I need to rescale the text strings font as well (possibly
just choosing a smaller font) is this possible by retrieving the
text
strings though the tag ?
Sure. Say you've tagged your items with the tag "text". You can find
(and modify) all of the text items using something like this:
foreach item [.c find withtag text] {
set oldText [.c itemcget $item text]
.c itemconfigure $item "New Text"
}
In your particular case (finding "text" type canvas elements), you
could also use the canvas "type" subcommand. Something like:
foreach item [.c find all] {
set type [.c type $item]
if {$type eq "text"} {
puts "text item found"
}
}
Note, the above code snippets were just typed into this message, so
while they could contain errors, they should be fairly close... ;^)
Jeff
.
- References:
- How to retrieve a text string information
- From: maura.monville@xxxxxxxxx
- Re: How to retrieve a text string information
- From: Uwe Klein
- Re: How to retrieve a text string information
- From: maura.monville@xxxxxxxxx
- How to retrieve a text string information
- Prev by Date: Re: How to retrieve a text string information
- Next by Date: Re: How to retrieve a text string information
- Previous by thread: Re: How to retrieve a text string information
- Next by thread: Re: How to retrieve a text string information
- Index(es):
Relevant Pages
|