title: NameError: global name 'messagebox' is not defined - CONSOLE MODE
body: <p>I've imported tkinter.messagebox, and my program runs smoothly when I F5 and test it on IDLE.
  However my program doesn't run on console when a messagebox should be displayed, and I get the error: </p>
  
  <pre class="lang-py prettyprint-override"><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File "C:\Program Files\lib\tkinter\__init__.py", line 1456, in __call__
      return self.func(*args)
    File "U:\my documents\6th form\A2\Computing\F454\Code and Prototyping\trackeve
  nts.py", line 204, in validation
      messagebox.showerror("Data invalid", "The data you have entered is invalid.
  Please make sure you have submitted it correctly.")
  NameError: global name 'messagebox' is not defined
  </code></pre>
  
  <p>My importing of messagebox and the section of code if it's needed:</p>
  
  <pre><code>import tkinter.messagebox
  
  def validation():
  (...)
  elif completedValidation == False:
      messagebox.showerror("Data invalid", "The data you have entered is invalid. Please make sure you have submitted it correctly.")
  </code></pre>