superjax / plotWindow

A tabbed plot window for matplotlib plots using PyQt5
23 stars 5 forks source link

Python crashes if too many plotWindow() have been opened #7

Closed davidpagnon closed 2 weeks ago

davidpagnon commented 1 year ago

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 1 year ago

Can you provide a minimal repro script?

davidpagnon commented 1 year ago

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()
davidpagnon commented 10 months ago

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

davidpagnon commented 9 months ago

Issue posted on stackoverflow.

davidpagnon commented 2 weeks ago

Fixed almost a full year later, by slightly changing the class plotWindow(). Closing the issue, hoping you can merge it! :)