使用matplotlib后崩溃关闭应用程序

时间:2016-09-30 12:43:52

标签: python matplotlib tkinter-canvas

在我显示并关闭了matplotlib图之后,我正试图关闭我的python tkinter应用程序(在ubuntu上)。我正在使用' x'关闭窗口。

invalid command name "140146113720200poll"
while executing

" 140146113720200poll"     ("在"脚本之后)

我显然没有正确地关闭一些东西,我发现有几个地方说应该关闭窗户关闭的数字,但数字没有接近的方法。我该怎么做才能正确释放我正在使用的资源?

def plotit(self):
    if self.gdata is None:
        return

    if self.plotframe is None:
        self.plotframe = tkinter.Toplevel()
        self.plotframe.title('graphy stuff')

    self.plotfig = matplotlib.pyplot.figure()
    canvas = FigureCanvasTkAgg(self.plotfig, master=self.plotframe)
    ax = Axes3D(self.plotfig)
    ax.scatter(self.gdata[0],self.gdata[1],self.gdata[2],marker='o',s=1.3)

    canvas.show()
    canvas.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=1)

    toolbar = NavigationToolbar2TkAgg(canvas, self.plotframe)
    toolbar.update()
    canvas._tkcanvas.pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=1)

我尝试在窗口上设置tkinter关闭操作,但这也没有帮助。

0 个答案:

没有答案