Strange behaviour of text widget
- From: Rob <dislexic_wobmat@xxxxxxxxxxxxxxx>
- Date: Tue, 07 Feb 2012 20:48:58 +1100
I have written the following code which reproducibly causes a strange
result. The text string used as input is actually 176 characters long
(according to the 'string length' command). Just in case it matters, this
text string contains with no internal line breaks.
text .txt -width 55 -wrap word
label .lbl -bg cyan3
pack .lbl -side top -fill x
pack .txt -side left
set comment "Science fiction author, journalist, and all around futurist
Cory Doctorow believes the recent copyright battles are the opening salvo of
a larger war against general computers."
..txt delete 1.0 end
..txt insert 1.0 $comment
update idle
set txtLines [.txt count -displaylines 1.0 end]
puts $txtLines
.....
.....
When the 'update idle' line of code is *not* used, the output from the puts
statement is 176. When the update line IS used, the result is 4.
Given that I was trying to get the count of the display lines produced,
these outcomes are confusing. From the visual evidence (text box), 4 is
obviously the correct outcome.
I have no idea what is causing this strange behaviour so am posting it here
so someone with a detailed understanding of the internals behind the text
widget can see it and offer an explanation and indication of whether I
should post a bug report.
TIA
Rob.
.
- Follow-Ups:
- Re: Strange behaviour of text widget
- From: Arjen Markus
- Re: Strange behaviour of text widget
- Prev by Date: Re: calling "c" from TCL
- Next by Date: Re: Strange behaviour of text widget
- Previous by thread: how to generate XML soap message
- Next by thread: Re: Strange behaviour of text widget
- Index(es):
Relevant Pages
|