Re: Text drag&drop
Michael Lange <[email protected]> Sun, 4 Nov 2018 22:56:25 +0100
| Newsgroups | gmane.comp.python.tkinter |
|---|---|
| Message-ID | <[email protected]> |
Hi, On Sun, 4 Nov 2018 19:37:29 +0000 Vasilis Vlachoudis <[email protected]> wrote: (...) > #1. However I cannot get rid of the #1. I've tried to subclass the > #DndHandler() > especially the on_motion() method to delete the text anchor (dirty > hack) after looking at the text.tcl as well deleting the selection and > calling the CancelRepeat to avoid the auto-scrolling, but nothing > worked ok. Is there a way to tell the Text() to stop the selection? I think you could add something like this to DnDHandler.__init__() : def _return_break(widget, event): return 'break' self._id = widget.bind('<B1-Motion>') widget.bind('<B1-Motion>', _return_break) which should remove the motion-selection binding and then restore it after the dnd operation has finished by adding self.initial_widget.bind('<B1-Motion>', self._id) to the end of DnDHandler.finish() (untested however). Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. "The combination of a number of things to make existence worthwhile." "Yes, the philosophy of 'none,' meaning 'all.'" -- Spock and Lincoln, "The Savage Curtain", stardate 5906.4