Re: How to retrieve a text string information



<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


.



Relevant Pages

  • Re: How to retrieve a text string information
    ... Users can place any number of such text strings at will. ... May I tag ... The default aspect ratio is 1:1.. ... I do not use the Tk command "rescale" as it does not result in a canvas ...
    (comp.lang.tcl)
  • Re: tag, tag_end in parser
    ... Iam in process of creating pull parser. ... parsing only with strings. ... starting of tag and end of tag. ... properly parsing XML would require writing an LL ...
    (comp.lang.ruby)
  • Re: Stack-based behaviour of Regexes
    ... These are relatively short strings ... and the DOM seems overkill and costly in terms of cycles ... this begins and where the corresponding tag ends (so the index ... If regular expressions can be used to do nested parenthesis then can't a ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Stack-based behaviour of Regexes
    ... These are relatively short strings ... and the DOM seems overkill and costly in terms of cycles ... this begins and where the corresponding tag ends (so the index ... If regular expressions can be used to do nested parenthesis then can't a ...
    (microsoft.public.vb.general.discussion)
  • Re: Stack-based behaviour of Regexes
    ... These are relatively short strings ... and the DOM seems overkill and costly in terms of cycles ... this begins and where the corresponding tag ends (so the index ... If regular expressions can be used to do nested parenthesis then can't a ...
    (microsoft.public.dotnet.languages.csharp)