Keep selection on Tkinter Entry widget despite not having focus
When a user selects a portion of text in a Tkinter Entry widget it becomes highlighted. However, when the user clicks away from the widget the highlighting disappears.
Is there any way to keep the selected text highlighted despite the Entry
widget not having fo开发者_JAVA百科cus?
I'm attempting to make a custom right-click menu not based on the Tkinter Menu widget (it's based on a Tkinter Toplevel widget), and I would like the text to remain highlighted despite the menu having focus.
You want to set the exportselection
option of the text widget to False
text_widget.configure(exportselection=False)
精彩评论