title: Save changed textbutton state back to dictionary value list index 0
body: <p>Good Day.</p>
  
  <p>I have managed to load a dictionary from a text file with this code:</p>
  
  <pre><code>def loadDictFile(data_folder):
      critDict = json.loads(open(data_folder+'critDict3.txt').read())
      print('json_data is', critDict)
      return critDict
  </code></pre>
  
  <p>And I can create a tkinter UI with checkboxes that are on or off according to the dictionary values using the following code:</p>
  
  <pre><code>def makeUI(data_folder, critDict):
      top = Tk()
      varList=[]
      for key, val in critDict.items():
          myVar = IntVar()#create intVar for this checkbutton
          varList.append(myVar) #append new intvar to a list
          key  = Checkbutton(top, text = key, command = update) #create new checkbutton with text
          if val[0] == 1:
              key.select()#turn on checkbutton if the dict value is 1
          key.pack()
          T = Text(top, height=2, width=30)#create text box
          T.pack()
          T.insert(END, val[1])#fill text box with comments from dict
          text = T.get("1.0",'end-1c')#get text from text box
  
  
      button=Button(top, text="Update", command=save)
      button.pack()
  
      top.mainloop()
  
  </code></pre>
  
  <p>the code running the functions is:</p>
  
  <pre><code>data_folder = "C:\\Users\\NB\\Desktop\\checkbuttonTest\\"
  critDict = loadDictFile(data_folder)
  makeUI(data_folder, critDict)
  </code></pre>
  
  <p>The dictionary text file critDict3.txt contains the following string:</p>
  
  <pre><code>{
    "crit2": [
      0,
      "comments2"
    ],
    "crit3": [
      1,
      "comments3"
    ],
    "crit1": [
      1,
      "comments"
    ],
    "crit4": [
      1,
      "comments4"
    ]
  }
  </code></pre>
  
  <p>This all seems to work fine.</p>
  
  <p>But I am having a great deal of difficulty figuring out how to take the values of any changed checkbuttons (buttons whose state has been changed by the user) and save them back to the dictionary so the changed values can be written back out to the text file.</p>
  
  <p>I think my problem is that, since I created the checkbuttons with a for loop, I'm not sure how to find the variable name of each intVar to get the check button state of the right check button to put into the right dictionary value list...if that makes sense.  </p>
  
  <p>If anyone can point me in the right direction, I would be most appreciative.</p>