Python 3 - 在列表框小部件中获取项目数量
问题描述:
有没有办法检索Listbox小部件中的项目数量值?如LEN()用于一个列表,但它不能用于列表框,因为它提供了以下错误:Python 3 - 在列表框小部件中获取项目数量
if len(listbox)==0:
TypeError: object of type 'Listbox' has no len()
答
要获得一个列表框的项目数,你可以这样做:
listbox.size()