title: How to pass a selected value from a TKinter listbox to a main TKinter script
body: <p>I can populate my listbox with a list of files, I want to select one file and return it to the main TKinter script for processing. I am here at the moment......</p>
  <p>'''cwd = os.getcwd()</p>
  <p>decrypt_this_file=&quot; &quot;</p>
  <p>def display_files():</p>
  <pre><code>window = Tk()
  window.geometry('350x250+400+200')
  window.title( 'Secrets Available' )
  
  frame = Frame( window )
  
  listbox = Listbox(frame)
  for name in os.listdir(cwd):
      if re.search(&quot;encrypted$&quot;,name):  
          listbox.insert('end', name)
  
  def dialog() :
      global decrypt_this_file
      box.showinfo( 'Selection' , 'Your Choice: ' + \
      listbox.get( listbox.curselection() ) )
      
      decrypt_this_file=listbox
  
  def close_box():
      window.destroy()
      
  
  btn = Button( frame, text = 'Select\nfile to\ndecrypt', command=dialog )
  btn2 = Button( frame, text = 'Close', command=close_box )
  
  btn.pack( side = RIGHT , padx = 5 )
  btn2.pack( side = RIGHT, padx=5)
  listbox.pack( side = LEFT )
  frame.pack( padx = 30, pady = 30 )
  
  window.mainloop()'''
  </code></pre>
  <p>but nothing is getting passed. Not sure where to go next. All help gladly received, Diolch yn fawr!</p>