I am writing a GUI using TKinter. And I ran into a problem for which I could not find a solution:
My interface has an input field (Entry
). The user enters some information into it. I need to prevent the user from highlighting the text in this field. It is important.
I tried to solve this problem by creating a stream withThreading
, and in an endless loop cleared the selection withselection_clear ()
... But I doubt this is a good decision. Maybe there is a way to track the text highlight event inEntry
?
@ splash58 Thank you. But there all the solutions prevent the user from entering text. And I need the user to be able to enter text, but at the same time he could not select it
Никита2021-12-29 07:52:40I did not find the selection event. Alternatively, catch the events of the release of the mouse button and keyboard keys, check the selection, if there is one, clear it.
insolor2021-12-29 09:00:08Thanks for the advice. I'll try.
Никита2021-12-29 09:01:16In Tcl /Tk, I would do this at the bind level or intercept the "selection" command itself. But there are generally quite a few events where the selection takes place (tk :: EntryMouseSelect, tk :: EntryKeySelect). Here are the default Entry bindings -github.com/tcltk/tk/blob/main/library/entry.tcl
GrAnd2021-12-29 09:34:28- Python Tkinter not seeing 'TimePL' instance of Label widget
- python : How can a scrollbar be attached to a label in tkinter
- python : Why root.attributes('-topmost', False) fires every other time?
- python : How to write functions for buttons to work?
- Working buttons in TKinter in Python in OOP
- python : How to create a large text input field?
- python : How to keep the scale of buttons, text, etc in tkinter?
- python : how to bind keyboard input in Tkinter
- python : how to find out the size of a Tkinter window?
- python : How to make txt to html text converter
look here. something similar -coderoad.ru/26208695/...
splash582021-12-29 07:43:35