How can I solve this ... ???

Hello all,

  I really need a help to solve this problem below ..., so let's go

  I have a Python script( plus Tkinter, Pmw and PmwContribD,

matplotlib ) with more than 5.000 lines and when I have included a
matplot Button code ( look excerpt of may code below ) appears
this error message after I use on_clicked( self.button_12Click ) to quit of that figure and ask to Tkinter
run it again …

  Error: 1
  <class '_tkinter.TclError'> Exception in Tk callback
    Function: <function callit at 0x00000000073B2C88> (type:

<type ‘function’>)
Args: ()
Traceback (innermost last):
File “C:\Python26\lib\site-packages\Pmw\Pmw_1_3\lib\PmwBase.py”,
line 1747, in call
return apply(self.func, args)
File “C:\Python26\lib\lib-tk\Tkinter.py”, line 495, in callit
func(*args)
File
“C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py”,
line 273, in idle_draw
self.draw()
File
“C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py”,
line 259, in draw
tkagg.blit(self._tkphoto, self.renderer._renderer,
colormode=2)
File
“C:\Python26\lib\site-packages\matplotlib\backends\tkagg.py”, line
19, in blit
tk.call(“PyAggImagePhoto”, photoimage, id(aggimage),
colormode, id(bbox_array))
<class ‘_tkinter.TclError’>: this isn’t a Tk application

  Apparently the problem is in  *tkagg.py module* , so how can

I solved this ???

  Excerpt of my code .:

  def graphic_1( self ):
          fig = pyplot.figure( figsize = ( 7.5, 4.5 ), dpi = 100 )
        Several code here ....
          widgets.Button( pyplot.axes( [ .91, .1, .08, .06 ] ),

self.textName[ 19 ],
color = self.cor[ 403 ][ 1 ],
hovercolor = self.cor[ 46 ][ 1 ] ).
on_clicked( self.button_12Click )
Several code here …
pyplot.show()

  def button_12Click( self, e = None ):    pyplot.close( "all" )

  I have tried to use this  *self.Master.update_idletasks()*       

with no sucess. Please aid me to find a solution.

  Thank you very much.
···
-- Ademir Francisco da Silva