Adding the cursor information bar

The cursor information bar is simply a small label at the bottom-right corner of the Text widget, which displays the current position of the cursor, as shown in the following screenshot:

Adding the cursor information bar

The user can choose to show/hide this info bar from the View menu (refer to the code in 2.11.py in the code bundle). Begin by creating a Label widget within the Text widget and pack it in the bottom-right corner, as follows:

cursor_info_bar = Label(content_text, text='Line: 1 | Column: 1')
cursor_info_bar.pack(expand=NO, fill=None, side=RIGHT, anchor='se')

In many ways, this is similar to displaying the line numbers. Here too, the ...

Get Tkinter GUI Application Development Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.