c_hall
c_hall

Reputation: 63

Python 3 - Getting amount of items in Listbox widget

Is there a way to retrieve a value of the amount of items in a Listbox widget? Such as len() is used for a list, but it cannot be used for Listbox as it gives the following error:

if len(listbox)==0:
TypeError: object of type 'Listbox' has no len()

Upvotes: 6

Views: 12137

Answers (1)

adder
adder

Reputation: 3698

To get the number of items in a listbox, you can do:

listbox.size()

Upvotes: 16

Related Questions