O'Reilly logo

Tkinter GUI Programming by Example by David Love

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Vertical movement

To go up and down lines, you could again cast the index to a float and add n.0 to it, but there is once again a much neater shortcut. This time, it is +nl or -nl, depending on the direction.

For example, if we had a shortcut to move the cursor three lines down, we could get its position with pos = text.index(tk.INSERT) and then set it to three lines lower with pos = pos + "+3l".

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required