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

Tkinter's indexing system

Indexing is handled in a somewhat coordinate-based way. An index is represented by two numbers separated by a single full stop. For example: 4.5.

The first number (before the .) in this index can be thought of as the line number. This begins at 1.

The second number (after the .) is how many characters into the line we are. This begins at 0.

The first character within a Text widget will therefore be located at 1.0. This means line 1, 0 characters in.

To ensure we fully understand this concept, let's create a demo application which will show us where the cursor is located at all times.

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