superjax/plotWindow

Python crashes if too many plotWindow() have been opened

davidpagnon opened this issue · 4 comments

Hi,

Thank you for this wrapper, it is quite useful.
When I open (and then close) a certain amount of plotWindow(), python crashes with error QGuiApplication::font(): no QGuiApplication instance and no application font set.

I know very little about PyQt5, and everything I tried did not work. Would you be able to provide this fix?
Thanks in advance.

jsjax commented

Can you provide a minimal repro script?

Sure! This crashes before the 3rd window is opened.

from plotWindow import plotWindow
import matplotlib.pyplot as plt
import numpy as np

for n in range(3):
	pw = plotWindow()
	x = np.arange(0, 10, 0.001)
	for i in range(1,3):
		f = plt.figure()
		ysin = np.sin(i*x)
		plt.plot(x, ysin, '--')
		pw.addPlot(str(i), f)
	pw.show()

Hi @jsjax, did you have a chance to look at this issue?