python – 更新到matplotlib prepends’alt’到keyrelease event.key

我将matplotlib从v1.1更新到v1.2.0 win32.我使用mpl_connect来处理keyevents.以前我用来检查keyrelease event.key的例子. ‘q’或’escape’,现在所有键都是’alt q’,’alt escape’.知道为什么吗?

示例代码:

import matplotlib.pyplot as plt

def close_fig(event):
   print event.key
   if event.key == 'q':
      plt.close(event.canvas.figure)

fig = plt.figure()
ax = fig.add_subplot(111)
fig.canvas.mpl_connect('key_release_event', close_fig)

data = [0,10,11,12]
ax.plot(data)
plt.show()

最佳答案 这看起来像是添加到matplotlib v1.2的修饰符键逻辑中的错误.

请将此示例报告给matplotlib问题跟踪器
https://github.com/matplotlib/matplotlib/issues/new,其中包含上述示例以及
http://matplotlib.org/faq/troubleshooting_faq.html#getting-help中讨论的相关详细信息.特别是,这很可能是后端问题,因此请提供您正在使用的后端以及操作系统信息.

谢谢!

点赞