python - How to get number of selected items in a listbox? -
i have 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 number of selected items in listbox?
in c#, it's:
listview1.selecteditems.count
how can in python?
i going assume you're asking listbox in tkinter not python built-in.
curselection()
returns tuple containing line numbers of selected element or elements, counting 0. if nothing selected, returns empty tuple.
Comments
Post a Comment