How To Remove Icursor From Tkinter Canvas Text Item?
I'm following along with Effbot's Tkinter page here: http://effbot.org/zone/editing-canvas-text-items.htm The trouble I'm having is that after inserting the icursor, I can't seem t
Solution 1:
self.canvas.focus("")
To remove focus from the item, call this method with an empty string. Reference
you can add the following
self.canvas.focus_set() # move focus to canvas windowself.canvas.focus("") # remove focus from the current item that has it
To
defset_focus(self, event):
if self.canvas.type(CURRENT) != "text":
#Herereturn
So when the user double-clicks on any part or item of the canvas that isn't created by canvas.create_text
the focus is removed from the current "text" item, hence stopping the edit.
Plus you can add
self.canvas.delete("highlight")
to remove the white rectangle around the text, when focus is removed.
Post a Comment for "How To Remove Icursor From Tkinter Canvas Text Item?"