Tkinter listbox clicking problem
Martin Franklin
mfranklin1 at gatwick.westerngeco.slb.com
Mon Sep 16 04:46:16 EDT 2002
Matthew,
On Friday 13 Sep 2002 4:49 pm, Matthew Bonig wrote:
> (lb.bind("<Button-1>", someFunc)) it calls function someFunc. Now,
> someFunc() simply prints the curselection(). The problem is it's lagged...
> if I first select list item 1 (index 0), and then 2, and then 3 (array
Simply change the binding to <ButtonRelease-1>
>>> root=Tk()
>>> lb=Listbox(root)
>>> lb.insert("end", 1)
>>> lb.insert("end", 2)
>>> lb.insert("end", 3)
>>> lb.insert("end", 4)
>>> lb.pack()
>>> def callback(event):
... print event.widget.curselection()
... print event.widget.get(event.widget.curselection()[0])
...
>>> lb.bind("<ButtonRelease-1>", callback)
'136346756callback'
>>> ('0',)
1
('1',)
2
('2',)
3
('3',)
4
('3',)
4
('2',)
3
('2',)
3
('1',)
2
('0',)
1
('1',)
2
('2',)
3
('3',)
4
HTH
Martin
--
### Python Powered Signature
I started writting this email on
Mon Sep 16 08:40:42 2002
More information about the Python-list
mailing list