An initial 'text see' command issued just after populating the text often doesn't work. In specific cases of complex layout, and/or when the text contains a lot of lines, doing 'update idletasks' or 'update' before the 'text see' doesn't solve the problem, and neither does performing the see in an 'after idle' or via a custom event sent via 'event generate'.
The wrong behavior can be seen with the attached example script: the initial call to center_text does not center the line in the text on display. Successive calls via the 'Center' button work.
A workaround seems to be to add the following lines at the beginning of proc center_text:
.texts.txt count -update -ypixels 1.0 end
.texts.lines count -update -ypixels 1.0 end
and to replace the line center_text with:
tkwait visibility .texts
after idle after 5 center_text
(thanks to Peter Spjuth for this)
This workaround is quite complicated and basically impossible to find without help. It would be better if an initial 'text see' command worked out of the box, without any need for such a trick.