Hi guys,
Im new in matplotlib and having some hard times. From the user point of view
everything works fine.
I have a window with a button. Pressing the button a new window pops showing
the plot. After play
with it i click at X to close this window. And click at X again to close the
window with the button.
BUT im not dropped back to a free prompt. The main window is locked and
still running in background.
Here goes the important parts of code:
import matplotlib
import matplotlib.pyplot as Plt
from matplotlib.figure import Figure
class MainPanel(wx.Panel):
def __init__(self, parent): #=None
wx.Panel.__init__(self, parent)
wxpython stuff goes here
self.btn1.Bind(wx.EVT_BUTTON, self.cplot)
def cplot(self, event):
self.new = NewWindow(self)
self.new.cidplot(self)
self.new.Show()
return
class NewWindow(wx.Frame):
def __init__(self,event):
wx.Frame.__init__(self, None, -1, 'Plot', size=(556, 618))
wx.Frame.CenterOnScreen(self)
self.Bind(wx.EVT_CLOSE, self.OnClose)
def OnClose(self,event):
self.Destroy()
def cidplot(self,event):
self.fig = Figure()
self.axes = self.fig.add_subplot(111)
self.canvas = FigCanvas(self, -1, self.fig)
self.axes.set_ylabel("Parts")
self.axes.set_ylim(0,100)
self.axes.grid(True)
more axes settings...
bars = self.axes.bar(left=self.ii, height=self.tt, width=0.2,
align='center', alpha=0.8)
self.canvas.draw()
Plt.savefig("Parts.pdf", dpi=300)
class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title = "System Test")
self.SetSize((556, 618))
panel = MainPanel(self)
self.Show()
if __name__ == "__main__":
app = wx.App(False)
frame = MainFrame()
app.MainLoop()
I think the problem is at self.fig = Figure() (Same happens if i use
Plt.figure())
Im doing something wrong when i create a new window or is at my matplotlib
part?
Some better way to do it?
Thanks in advance. Any ideia is welcome.
--
View this message in context:
http://matplotlib.1069221.n5.nabble.com/After-close-the-plot-window-the-process-keeps-running-tp40919.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users