Reputation:
I have a listbox:
self.listBox = Listbox(self.master,
selectmode='multiple',
height = 34,
width = 38)
self.listBox.grid(row = 3, column = 0, rowspan = 7, sticky = W)
I don't know how to get the number of selected items in the listbox?
In C#, it's:
listView1.SelectedItems.Count
How can I do this in Python?
Upvotes: 2
Views: 1601
Reputation: 113
I am going to assume you're asking about the listbox in Tkinter as it is not a Python built-in.
curselection()
Returns a tuple containing the line numbers of the selected element or elements, counting from 0. If nothing is selected, returns an empty tuple.
Upvotes: 2