Keyboard doesn't work on windows when using plot on an mne raw object

Hello,
Hope that someone will be able to help.

I wrote the following code:


rawData = mne.io.read_raw_edf(…)
rawDownsampled = rawData.copy().resample(sfreq = 128)

… # pre-preocessing stuff

fig = rawDownsampled.plot(title = ‘After removing bad channels, you can clean me manually :)’, show_scrollbars = True, duration = 30)
fig.canvas.key_press_event(‘a’)
plt.show()


This allows me to go over the data manually, add / modify labels etc. All is great, and keyboard arrows and ± (which are used for scaling) work great on MAC but do now work on Windows! In fat, it doesn’t accept any keyboard input, but only mouse input works.
I’ve tried adding matplotlib.use(‘TkAgg’) to my script but that doesn’t help.

Have someone encountered this? Is there a solution?
Thanks!

Have you tried using the QtAgg backend matplotlib.use("QtAgg")?

Thanks! Yes, I’ve tried. The script gives an error :frowning:

Can you post the error please?

I tried this again, didn’t work. Then, I ran:

pip install PyQt5

And now it works. Thanks so much for your help!