Pyqt5, Matplotlib incompatibility?
-
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)Ive done fresh pip installs of both pyqt5 and matplotlib 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) -
Hi,
Did you try to tell matplotlib to explicitly use its Qt backend ?
-
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)Ive done fresh pip installs of both pyqt5 and matplotlib 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)@Samuel-Liu_ said in Pyqt5, Matplotlib incompatibility?:
It does not work if i import QFileDialog
What does "does not work" mean exactly? What happens?
-
This post is deleted!
-
@Samuel-Liu_ said in Pyqt5, Matplotlib incompatibility?:
It does not work if i import QFileDialog
What does "does not work" mean exactly? What happens?
@jsulm A Non responsive white box appears and crashes python
-
@jsulm A Non responsive white box appears and crashes python
@Samuel-Liu_ And this does not happen if you remove
from PyQt5.QtWidgets import QFileDialog
?
-
@Samuel-Liu_ And this does not happen if you remove
from PyQt5.QtWidgets import QFileDialog
?
@jsulm This does not happen.
I can also only post every 10 minutes because of the reputation restriction here -
@Samuel-Liu_ And this does not happen if you remove
from PyQt5.QtWidgets import QFileDialog
?
@jsulm Can you replicate the issue? I want to know if its just me
-
@jsulm Can you replicate the issue? I want to know if its just me
@Samuel-Liu_ Start the script from a terminal and see whether there are any errors/warnings.
-
@Samuel-Liu_ Start the script from a terminal and see whether there are any errors/warnings.
@jsulm No errors just an unresponsive white box
-
Hi,
Did you try to tell matplotlib to explicitly use its Qt backend ?
-
@SGaist No I did not, much thanks for the idea.
It works perfectly now. To use matplotlib's Qt backend use the following:
import matplotlib
matplotlib.use('Qt5Agg')