title: Can't pickle _tkinter.tkapp objects
body: <p>The problem in that I can't pickle the text in entry fields. I try to make it in the 'record' function. </p>
  
  <p>Error: <code>can't pickle _tkinter.tkapp objects</code></p>
  
  <p>I want to save data in the file and then read it.</p>
  
  <p><strong>Interface:</strong>
  <a href="https://i.stack.imgur.com/1oXAv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1oXAv.png" alt="enter image description here"></a></p>
  
  <pre><code>#program to record and store your sports results
  
  import shelve
  from tkinter import *
  
  class Application(Frame):
      '''GUI application ере displays menu for the programm'''
      def __init__(self, master):
          '''Initialize Frame'''
          super(Application, self).__init__(master)
          self.grid()
          self.create_widgets()
  
      def create_widgets(self):
          ''' Create widgets to get story information and to display story. '''
  
          self.fileDat = 'data'  
  
          # label date
          Label(self,
                text = "date:"
                ).grid(row = 0, column = 0, columnspan = 2, sticky = W)
  
          # field date
          self.date_ent = Entry(self)
          self.date_ent.grid(row = 1, column = 1, sticky = W)
  
  
          # label №
          Label(self,
                text = "№:"
                ).grid(row = 0, column = 3, columnspan = 2, sticky = W)
  
          # field №
          self.number_ent = Entry(self)
          self.number_ent.grid(row = 1, column = 4, sticky = W)
  
  
          # label km
          Label(self,
                text = "km:"
                ).grid(row = 2, column = 0, columnspan = 2, sticky = W)
  
          # field km
          self.km_ent = Entry(self)
          self.km_ent.grid(row = 3, column = 1, sticky = W)
  
  
          # label time
          Label(self,
                text = "time:"
                ).grid(row = 3, column = 0, columnspan = 2, sticky = W)
  
          # field time
          self.time_ent = Entry(self)
          self.time_ent.grid(row = 4, column = 1, sticky = W)
  
  
          # record button
          Button(self,
                 text = "record training",
                 command = self.record
                 ).grid(row = 5, column = 0, sticky = W)
  
  
          # show training button
          Button(self,
                 text = "show trining",
                 command = self.tngDisplay
                 ).grid(row = 5, column = 3, sticky = W)
  
          self.tngField = Text(self, width = 75, height = 10, wrap = WORD)
          self.tngField.grid(row = 6, column = 0, columnspan = 4)
  
  
      def listRecord( self):
          date = self.date_ent.get()
          km = self.km_ent.get()
          time = self.time_ent.get()
          tng = [date,km, time]
          return tng
  
      def record (self):
  
          tngList = self.listRecord
          tngNumber = self.number_ent.get()
  
          datFile = shelve.open(self.fileDat)
          datFile[tngNumber] = tngList
          #datFile['1'] = tngList
          datFile.sync()
          datFile.close()
  
      def tngDisplay (self):
          tng = ''
  
          self.tngField.delete(0.0, END)
          #i=0
          datFile = shelve.open(self.fileDat)
          for key, item in datFile.items():
              tng = str(key) + ': ' + str(item)
              # display trainings                                
              self.tngField.insert(0.0, tng)
              #i+=1
  
  
  root = Tk()
  root.title('RunForest')
  app = Application(root)
  root.mainloop()
  </code></pre>