开发者

Keep selection on Tkinter Entry widget despite not having focus

开发者 https://www.devze.com 2023-03-26 03:50 出处:网络
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.

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)
0

精彩评论

暂无评论...
验证码 换一张
取 消