title: confirm and mainloop in pyautogui, and tkinter
body: <p>I am looking for the way I can use x value within Tkinter widget.
  I couldn't find an appropriate answer from the web.
  Any advice is appreciated.
  Thanks</p>
  <hr />
  <p>regarding, confirm, it returns x and print(x) works.</p>
  <pre><code>from pyautogui import *    
  def test():
      global x
      x = confirm(buttons=['z2037', 'z2039'])        
  test()
  print(x)
  </code></pre>
  <hr />
  <pre><code>from pyautogui import *
  from tkinter import *
  root = Tk()    
  def test():
      global x
      x = confirm(buttons=['Z2 037', 'Z2 039'])    
  
  b = Button(root, text='KLO', padx=50, pady=50, command=test)
  b.pack()
  
  root.mainloop()
  print(x)
  </code></pre>
  <p>If I add print(x) above root.mainloop(), Python throws an error, saying that name 'x' is not defined although it's global.
  If I add print(x) below root.mainloop(), it works.</p>
  <p>But, I want to use x value(Z2 037, or Z2 039) inside tkinter widget. Is there any way to do that?</p>