event.ind在选择特定对象时返回错误的索引

2024-05-12 21:10:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我现在有三个不同的目标:公共汽车、铁路和sgen。 当我尝试使用event.ind[0]选择总线或线路时,它将返回我选择的对象的相应索引。 当我选择一个sgen时,它会返回一个太高的索引,并返回一个索引器,因为列表没有那么长。 对matplotlib了解不多,我真的很困惑为什么会这样

collection = event.artist
        print("----------------------COLLECTION.INFO---------------------------")
        print(collection.info)
        print("--------------------------EVENT---------------------------------")
        print(event)
        print("------------------------EVENT.IND-------------------------------")
        print(event.ind)
        print("-----------------------EVENT.IND[0]-----------------------------")
        print(event.ind[0])
        element, index = collection.info[event.ind[0]]

这是我将获得的命令日志:

https://i.stack.imgur.com/ySnvz.png

非常感谢您的帮助


Tags: 对象infoevent目标列表matplotlib线路collection