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 python.org. 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. )
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.
Can you try with plt.show(block=True)? 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).
@tacaswell
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 plt.show()'s, some third party. But thanks.
@jklymak
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!”)
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).