Search code examples
pythonuser-interfacetkinterwidgetcursor-position

Block Insertion Cursor Style in Tkinter Entry Widget


The tkinter text widget has a blockcursor option, which makes the default insertion cursor into a block insertion cursor. This is the sort of insertion cursor style used in command lines. I would like to replicate this style in a tkinter entry widget.

The issue I am having is that there is no such blockcursor option for a tkinter entry widget. The only alternative I have found is changing the insertwidth of the entry widget, but that leaves the insertion cursor centered between two characters and covers half of the character to the left and right of the insertion cursor. Ideally, I would like a block insertion cursor styling that covers the entirety of a character. Is there another way to go about this or perhaps a way to offset the cursor so that it covers a whole character?

Any help would be much appreciated.

And if it is any aid, below is the farthest I have come with my entry widget configurations:

inputentry = Entry(self.root, bg = 'black', fg = '#00ff00', width = 60)
inputentry.config(font='Courier', insertbackground = '#00ff00', highlightthickness = 0)
inputentry.config(relief = 'flat', insertwidth = 5)

Solution

  • Is there another way to go about this or perhaps a way to offset the cursor so that it covers a whole character?

    No, there is not. The options you mentioned in the question are all that are available with respect to the insertion cursor.