PyQt and matplotlib

I am calling matplotlib function plt.show()

from PyQt application. I always have a warning:

QCoreApplication::exec: The event loop is already running

      

It seems that matplotlib has called a new QCoreApplication which is already running. How can I remove this warning? Thanks to

+3


source to share


2 answers


If you are not creating multiple plots, the easiest way is to use it plt.ion()

before initializing the drawing. Deleteplt.show()



+5


source


I am having similar problems. The main reason is that your PyQt application is using Qt (which is of course obvious). But the matplotlib figure you are trying to make also uses Qt. You know matplotlib figure has its own window which comes from Qt. So there is a conflict.

Approach 1

There are several ways to solve it. One way is explained here:

animating Matplotlib inside PyQt4 native GUI



The link links to a stack question I posted online a few days ago. I was trying to run matplotlib animation from my own PyQt application.

Approach 2 The second approach is explained here:

Can't move matplotlib plot window and exit using red X button

Hope this helped you. If you have any questions, do not hesitate to ask me. I'm glad to help.

0


source







All Articles