Pyplot Buttons Do Not Work with Python 3.9.9

The default buttons on PyPlot windows do not work with Python 3.9.9 (most of the time). I submitted this as a bug. [Bug]: The default Pyplot buttons are unresponsive with Python 3.9.9. · Issue #21736 · matplotlib/matplotlib · GitHub. It was immediately closed, saying it was an installation problem (the backend needs to be updated ?), and that I should continue dealing with it here.

In more detail, the buttons usually do not respond (don’t show they are pressed and don’t do anything). Occasionally they do. Home can typically be depressed but almost never restores the plot.

Apart from the buttons, Matplotlib works fine.

There are more details in the bug report, but the summary is the buttons work with 3.7 and not with 3.9.9. I checked with several Matplotlib versions including 3.5.0. This is on Windows 10.

Python 3.9.9 is relatively new and was recently installed via a download from Tkinter is installed with Python. Pip is not indicating it is out of date, and I am not sure what to do. (Nor why I should have do do anything to use Matplotlib on a recent Python version. :wink:)

Any help would be appreciated.

From your 3.9 installation, maybe see if a basic tkinter program with buttons will work i.e. GUI Programming with Python: Buttons in Tkinter If that works well, then it is worth pursuing here further.

@jklymak, Thx. I am away from my computer for a couple of days. I’ll try that as soon as I can.

Can you try with In the past there has been some issues with the input hook / event loop integration on windows (that required a patch at the CPython level).

No, that does not help. Also I’d rather not do that other than as a test. it’s not standard, and I have a fair number of's, some third party. But thanks.

I tried the following from your link (adding the Python version to the output to verify it is the right version).

import tkinter as tk
import sys

def write_slogan():
print(f"Python version: {sys.version}")
print(“Tkinter is easy to use!”)

root = tk.Tk()
frame = tk.Frame(root)

button = tk.Button(frame,
slogan = tk.Button(frame,


The buttons work (in both 3.7 and 3.9), and the output of the Hello button is:

Python version: 3.9.9 (tags/v3.9.9:ccb0e6a, Nov 15 2021, 18:08:50) [MSC v.1929 64 bit (AMD64)]
Tkinter is easy to use!

The backend is TkAgg.

I also did this:

py -m pip list --outdated
Package Version Latest Type

fonttools 4.28.1 4.28.2 wheel
prompt-toolkit 3.0.22 3.0.23 wheel
setuptools 59.2.0 59.3.0 wheel
six 1.12.0 1.16.0 wheel

Yes, I would certainly like to pursue it further. I will reiterate that this Python 3.9 is a recent install, and tkinter is installed with Python. I have not modified it except to install numpy 1.21.4 and matplotlib 3.5.0. However, I may have updated pip.

Since the above post, I realize it is logically possible my Python 3.9.9 could have got corrupted somehow. The obvious thing to do would be to reinstall it.

What I did instead is install 3.10. I then upgraded Pip and installed Numpy and Matplotlib, nothing else. Running a simple plot (the one listed in the bug report), the buttons seem to work. (At least most of the time, as opposed to not working most of the time with 3.9.9. They still don’t work every time.)

The project I am currently working on has a lot of other stuff installed in a virtual environment. I replaced that environment with a 3.10 environment and reinstalled everything via a requirements.txt. After doing that the buttons still work most of the time in the few runs I have tried.

I have no problem with using Python 3.10 rather than 3.9.9, so I see no need to continue debugging this problem (unless further use indicates there is still a problem).

Thanks for your help.