I'm using Tkinter to make a small program, but I've run into troubles with pasting.
I want to be able to click text in a Text widget with the middle mouse button without it pasting anything. I have tried things like binding over it:
text.bind('<<Paste>>', lambda x: 'break')
But this only disables the keyboard Ctrl-V pasting, not the middle mouse. This makes me think that perhaps it is an X11 (I am on Debian) issue, but even if that is the case, is there a way to intercept the paste event? I would like to make it as portable as possible.
text.tclwhich is usually in/usr/share/tcltk8.6on debian to see what bindings the text widget has by default. This will tell you what you need to re-bind. - msw<<PasteSelection>>, instead of<<Paste>>. This preserves the Ctrl-V pasting, but disables the middle click paste. You can post it as an answer and I'll be happy to accept :) - user4934382