[Tkinter-discuss] Is there a way to scroll Tkinter.Text widget by pixel instead of see() (which scrolls by line)?

Michael Lange klappnase at web.de
Wed Mar 18 11:59:44 CET 2015


On Wed, 18 Mar 2015 02:49:22 +0100
jevan at freenet.de wrote:

> When I type in the Text widget the text lines wrap toward  the bottom
> of the page, the caret reaches the bottom of the Text widget.  When I
> hit return, the caret dissapears out of view. When I type a  character,
> the view finally scrolls up one line allowing me to see the  character
> just typed.

I cannot reproduce this behavior here, could you please post a minimal
code example that shows the problem?

> See doesn't seem to want to show  this next line always, so
> I can't see. Is there a way scroll the Text  widget by pixel, so I can
> get pixel perfect scrolling?  And/or how do I get the line that get the
> carriage return to allways bee seen on a enter?

Hmm, I think text.see('insert') should do the trick, maybe you would have
to add update_idletasks() for it to take effect, however if you process
every key press it is probably no good idea to call update_idletasks()
every time...

> FYI: I am breaking each
> character because I have to custom process each character because the
> editor has several custom formating things that must occur. So the
> Enter is actually put in with Text.insert(), not after I have return
> 'break' in from the keypress event. Could this be something to do with
> it?

Probably, if we could see a code example it might help to track down the
cause for the problem.



.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

We'll pivot at warp 2 and bring all tubes to bear, Mr. Sulu!

More information about the Tkinter-discuss mailing list