Peter Moscatt wrote:
I am having trouble understanding the methods for the Listbox from Tk.

If I was to select at item in the list using a mouse click (have already
created the bind event) - what method returns the text of the selected
item ?

Pete



Pete,

pydoc Tkinter.Listbox

<snip>

 |  curselection(self)
 |      Return list of indices of currently selected item.
 |
 |  delete(self, first, last=None)
 |      Delete items from FIRST to LAST (not included).
 |
 |  get(self, first, last=None)
 |      Get list of items from FIRST to LAST (not included).

So to get the value of the selected item:

lb.get(lb.curselection()[0])


provided the listbox is in single selection mode or only one item is selected

Martin


-- http://mail.python.org/mailman/listinfo/python-list

Reply via email to