[Tkinter-discuss] How to prevent a selection when double-clicking?

Juha Salo juha.k.salo at gmail.com
Sat May 19 07:42:37 CEST 2012


Hi!

Is there a way to get rid of the selection (blue area in the window) after
double-clicking on a Text widget? I use Vista and Python 3.2.3. I have the
following example:

import tkinter as tk

root = tk.Tk()

def dbclick(e):
    print('db click')
    #Can I add some code here to automatically prevent the selection from
appearing?

txt = tk.Text()
txt.insert('insert', 'fooo')
txt['state'] = 'disabled'
txt.bind('<Double-Button-1>', dbclick)
txt.pack()

root.mainloop()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20120519/93b75971/attachment.html>


More information about the Tkinter-discuss mailing list