A
Anthony Papillion
So I want to execute some code when the user double clicks an item in
a ListBox. The documentation says I should use the listbox.bind()
method, specifying the Double-l event to detect the double left mouse
button click. My code is this:
gsItems = Listbox(root, width=76, height=30, selectmode="browse",
yscroll=scrollBar.set)
gsItems.bind('<Double-l>', openandDisplayFolder)
gsItems.pack()
So the first line configures the Listbox, second line SHOULD set up
the event, and third line, of course, adds the Listbox to the UI.
The problem is that the openandDisplayFolder function is never
executed. The function is VERY simple for now while I learn the way to
do it:
def openandDisplayFolder(event):
tkMessageBox.showinfo("Event Fired", "An item has been double
clicked!")
I've also removed the (event) parameter just in case and tried it and
it makes no difference. What am I doing wrong here?
Thanks!
Anthony
a ListBox. The documentation says I should use the listbox.bind()
method, specifying the Double-l event to detect the double left mouse
button click. My code is this:
gsItems = Listbox(root, width=76, height=30, selectmode="browse",
yscroll=scrollBar.set)
gsItems.bind('<Double-l>', openandDisplayFolder)
gsItems.pack()
So the first line configures the Listbox, second line SHOULD set up
the event, and third line, of course, adds the Listbox to the UI.
The problem is that the openandDisplayFolder function is never
executed. The function is VERY simple for now while I learn the way to
do it:
def openandDisplayFolder(event):
tkMessageBox.showinfo("Event Fired", "An item has been double
clicked!")
I've also removed the (event) parameter just in case and tried it and
it makes no difference. What am I doing wrong here?
Thanks!
Anthony