Closed
Description
Bug summary
The "key_press_event" is not handled. It looks as if this event is not connected by the event handler.
- This mistake appears under Windows (Win10 & Win11), and NOT under Linux.
- It does NOT appear with Matplotlib 3.4.1, but DOES appear with Matplotlib 3.5.1
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
def on_key(event):
print('you pressed', event.key, event.xdata, event.ydata)
if __name__ == '__main__':
t = np.arange(0, 20, 0.1)
x = np.sin(t)
fig, ax = plt.subplots()
ax.plot(t, x)
ax.set_title('Enter a key:')
fig.canvas.mpl_connect('key_press_event', on_key)
plt.show()
Actual outcome
Figure is plotted, but no keyboard input is handled/indicated.
Expected outcome
Figure is plotted, AND keyboard inputs are displayed.
Additional information
Does NOT happen in Matplotlib 3.4.1
Does NOT happen under Linux
Operating system
Windows
Matplotlib Version
3.5.1
Matplotlib Backend
No response
Python version
TkAgg
Jupyter version
No response
Installation
No response