title: unable to use variable of one function to another function in tkinter python
body: <p>I am trying to create the GUI, I am unable to use the value of a variable in one function on the other function in tkinter</p>
  
  <p>But, in normal functions, when we declare the variable as global, it is accessible.</p>
  
  <p>Here is my code,</p>
  
  <pre><code>from tkinter import *
  global chosen_option
  root = Tk()
  root.title("Drop-down boxes for option selections.")
  
  var = StringVar(root)
  var.set("drop down menu button")
  
  def grab_and_assign(event):
      grab_and_assign.var = var.get()
      label_chosen_variable= Label(root, text=chosen_option)
      label_chosen_variable.grid(row=1, column=2)
      print(chosen_option)
  
  def pri():
      print(grab_and_assign.chosen_option)
  
  drop_menu = OptionMenu(root, var,  "one", "two", "three", "four", "meerkat", "12345", "6789", command=grab_and_assign)
  drop_menu.grid(row=0, column=0)
  
  label_left=Label(root, text="chosen variable= ")
  label_left.grid(row=1, column=0)
  pri()
  
  root.mainloop()
  </code></pre>