title: not able to display multiple (JSON) "keys" in tkinter gui
body: <p>I have been playing with <code>tkinter</code> and used a lot of web resources and currently have this code:</p>
  
  <pre><code>import json
  import tkinter as tk
  from tkinter import ttk
  from pprint import pprint as pprint
  
  # opt_name: (from_, to, increment)
  IntOptions = {
      'age': (1.0, 200.0, 1.0),
  }
  
  def close_ed(parent, edwin):
      parent.focus_set()
      edwin.destroy()
  
  def set_cell(edwin, w, tvar):
      value = tvar.get()
      w.item(w.focus(), values=(value,))
      close_ed(w, edwin)
  
  def edit_cell(e):
      w = e.widget
      if w and len(w.item(w.focus(), 'values')) &gt; 0:
          edwin = tk.Toplevel(e.widget)
          edwin.protocol("WM_DELETE_WINDOW", lambda: close_ed(w, edwin))
          edwin.grab_set()
          edwin.overrideredirect(1)
          opt_name = w.focus()
          (x, y, width, height) = w.bbox(opt_name, 'Values')
          edwin.geometry('%dx%d+%d+%d' % (width, height, w.winfo_rootx() + x, w.winfo_rooty() + y))
          value = w.item(opt_name, 'values')[0]
          tvar = tk.StringVar()
          tvar.set(str(value))
          ed = None
          if opt_name in IntOptions:
              constraints = IntOptions[opt_name]
              ed = tk.Spinbox(edwin, from_=constraints[0], to=constraints[1],
                  increment=constraints[2], textvariable=tvar)
          else:
              ed = tk.Entry(edwin, textvariable=tvar)
          if ed:
              ed.config(background='LightYellow')
              #ed.grid(column=0, row=0, sticky=(tk.N, tk.S, tk.W, tk.E))
              ed.pack()
              ed.focus_set()
          edwin.bind('&lt;Return&gt;', lambda e: set_cell(edwin, w, tvar))
          edwin.bind('&lt;Escape&gt;', lambda e: close_ed(w, edwin))
  
  def JSONTree(Tree, Parent, Dictionery, TagList=[]):
      for key in Dictionery :
          if isinstance(Dictionery[key], dict):
              Tree.insert(Parent, 'end', key, text=key)
              TagList.append(key)
              JSONTree(Tree, key, Dictionery[key], TagList)
              pprint(TagList)
          elif isinstance(Dictionery[key], list):
              Tree.insert(Parent, 'end', key, text=key) # Still working on this
          else:
              Tree.insert(Parent, 'end', key, text=key, value=Dictionery[key])
  
  if __name__ == "__main__" :
      # Setup the root UI
      root = tk.Tk()
      root.title("JSON editor")
      root.columnconfigure(0, weight=1)
      root.rowconfigure(0, weight=1)
      # Setup Data
      Data = {'aeroplane': {'Configuration': 'air_travel',
                 'Distance': '1000',
                 'From': 'miami_airport',
                 'Name': 'united',
                 'To': 'pasco'},
              }
      # Setup the Frames
      TreeFrame = ttk.Frame(root, padding="3")
      TreeFrame.grid(row=0, column=0, sticky=tk.NSEW)
      # Setup the Tree
      tree = ttk.Treeview(TreeFrame, columns=('Values'))
      tree.column('Values', width=100, anchor='center')
      tree.heading('Values', text='Values')
      tree.bind('&lt;Double-1&gt;', edit_cell)
      tree.bind('&lt;Return&gt;', edit_cell)
      JSONTree(tree, '', Data)
      tree.pack(fill=tk.BOTH, expand=1)
      # Limit windows minimum dimensions
      root.update_idletasks()
      root.minsize(root.winfo_reqwidth(), root.winfo_reqheight())
      root.mainloop()
  </code></pre>
  
  <p>I ran it using python IDLE and it passes and generates a window with <code>aeroplane</code> and the drop-down has all the details of that dictionary and it looks like this:
  <img src="https://i.stack.imgur.com/Z2CAG.png" alt="showing just aeroplane"></p>
  
  <p>BUT if I change my <code>Data</code> to:</p>
  
  <pre><code>Data = {'aeroplane': {'Configuration': 'air_travel',
             'Distance': '1000',
             'From': 'miami_airport',
             'Name': 'united',
             'To': 'pasco'},
          'bus': {'Configuration': 'road_travel',
              'Distance': '15',
              'From': 'pasco',
              'Name': 'greyhound',
              'To': 'richland'},
          'car': {'Configuration': 'road_travel',
              'Distance': '160',
              'From': 'Richland',
              'Name': 'honda',
              'To': 'Seattle'},
          'train': {'Configuration': 'train_travel',
              'Distance': '30',
              'From': 'beach',
              'Name': 'gas_train',
              'To': 'miami_airport'}}
  </code></pre>
  
  <p>and running this generates me an error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Users/gour967/Desktop/json_gui_test.py", line 97, in &lt;module&gt;
      JSONTree(tree, '', Data)
    File "/Users/gour967/Desktop/json_gui_test.py", line 53, in JSONTree
      JSONTree(Tree, key, Dictionery[key], TagList)
    File "/Users/gour967/Desktop/json_gui_test.py", line 58, in JSONTree
      Tree.insert(Parent, 'end', key, text=key, value=Dictionery[key])
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/ttk.py", line 1348, in insert
      "-id", iid, *opts)
  _tkinter.TclError: Item Configuration already exists
  </code></pre>
  
  <p>How to address this error and display <code>aeroplane, bus, car, train</code> just like I the above image looks?</p>