Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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()
like image 500
c_hall Avatar asked Dec 23 '22 13:12

c_hall


1 Answers

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

listbox.size()
like image 175
adder Avatar answered Dec 27 '22 10:12

adder