title: Can't finish process after pressing exit button on tkinter
body: <p>my problem is that I have a GUI made in tkinter that plots some maps and info and that part works good, but when I try to close the program with the X button of the window, the process is still running and I have to kill the process with the stop button, as read <a href="https://stackoverflow.com/questions/14838635/quit-mainloop-in-python">in this question</a> they recommend to run in CMD, I did it on windows and check the task manager and after closing the program the process still continued, what can i do to fix that?
  Here is the structure of the script: </p>
  
  <pre><code>#This is some figure where i plot the maps
  #marco de imagen principal
  f = plt.figure(figsize=(3,3))
  axe = f.add_subplot(111)
  #axe = f.add_subplot(111)
  #plt.axis('off')
  axe.format_coord = lambda x, y: ''
  
  #marco de ploteo de mapa
  figu=plt.Figure(figsize=(2,2))
  #ploteo=figu.add_subplot(111)
  ploteo=figu.add_axes([0, 0, 1, 1])
  ploteo.format_coord = lambda x, y: ''
  plt.axis('off')
  
  
  Class Inicio(tk.Tk):
       def __init__(self, *args, **kwargs):
       #I initialize all the menu, labels, variables and canvas and some other functions
  
       def libro(self):
  
       def onpress(self,event):
       .
       .
       .
       and more funtions
  
  
  ex = Inicio()
  ex.geometry("1280x720")
  
  ex.mainloop()
  </code></pre>
  
  <p>Maybe the problem has to do with the plot?</p>