[Python-de] unbinding button-1 in Text Widget
Christof Ecker
ecker at physik.hu-berlin.de
Fri Mar 22 13:51:13 EST 2002
Hallo,
ich würde gerne die mittlere Maustaste in Tkinters Text-Widget neu belegen.
Bin aber bisher gescheitert. Das Default-Binding ("Insert Selection") lässt
sich einfach nicht überschreiben:
from Tkinter import *
tk = Tk()
text = Text(tk)
text.pack()
text.unbind("<Button-2>")
text.unbind_all("<Button-2>")
text.unbind_class(Text, "<Button-2>")
def nada(event):
return "break"
text.bind("<ButtonPress-2>", nada)
text.bind_class(text, "<Button-2>", nada)
text.bind_all("<Button-2>", nada)
tk.mainloop()
Nada wird zwar ausgeführt, die Selection wird aber trotzdem weiterhin
eingefügt !
Christof
More information about the Python-de
mailing list