[Tkinter-discuss] Listbox selection issue
Michael Lange
klappnase at web.de
Sat Apr 17 19:03:04 EDT 2004
On Fri, 16 Apr 2004 09:29:15 -0300
"Batista, Facundo" <FBatista at uniFON.com.ar> wrote:
> #-
> #- ...
> #- self.listbox.bind("<Button-1>", self.noIr)
> #- ...
> #-
> #- def noIr(self, evento):
> #- '''Dummy function to stop a mouse-click from selecting
> #- a listbox item.'''
> #- return "break"
> #-
> #- I hope this helps
>
> No. Was told about this out-of-list. The issue is this ways neither works
> double-click.
>
> . Facundo
>
I can hardly believe that, I wrote a little test app and double clicking works fine here:
###########file test.py############################################
#!/usr/bin/env python
from Tkinter import *
class Test(Tk):
def __init__(self):
Tk.__init__(self)
l = Listbox(self)
l.pack()
l.insert('end', 'line 1')
l.insert('end', 'line 2')
l.insert('end', 'line 3')
l.bind('<1>', self.dummy)
l.bind('<Double-Button-1>', self.test)
def dummy(self, event):
return 'break'
def test(self, event):
print 'hello'
if __name__ == '__main__':
t = Test()
t.mainloop()
######################################################################
At least on my box (Python2.2/Tk8.3) the listbox behaves just like I expected.
What does the function you bound to '<Double-Button-1>'-events look like, maybe this
one is the problem here?
Regards
Michael
More information about the Tkinter-discuss
mailing list