我有一个 matplotlib,我创建了一个button_press_event
这样的:
self.fig.canvas.mpl_connect('button_press_event', self.onClick)
def onClick(self, event)
if event.button == 1:
# draw some artists on left click
elif event.button == 2:
# draw a vertical line on the mouse x location on wheel click
elif event.button == 3:
# clear artists on right click
现在是否可以将滚轮点击处理程序修改为这样的东西
elif event.button == 2 or (event.button == 1 and event.key == "shift"):
# draw a vertical line on the mouse x location
# on wheel click or on shift+left click
# (alternative way if there is no wheel for example)
似乎button_press_event
不支持按键,key_press_event
也不支持鼠标点击,但我不确定。
有办法吗?