Im trying to display a graph with data generated from a Gui using matplotlib. It does not work if I import QFileDialog
and try to do plt.show(block=False)
. plt.show()
works but naturally, blocks further commands
Ive done fresh pip installs of both pyqt5 and matplotlib in a venv and here is some code to reproduce:
import matplotlib.pyplot as plt
from PyQt5.QtWidgets import QFileDialog
a=[1,2,3]
plt.plot(a)
plt.show(block=False).
Can someone help me get around this? Will this also happen if I try to convert to pyside2?
To solve, use matplotlib's Qt backend:
import matplotlib
matplotlib.use('Qt5Agg')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.