title: How to get Tkinter to input text and submit with button
body: <p>Hi I was wondering if anybody could help me submit code from the text fields to the login fields and then br.submit(name="wp-submit") with the login button</p>
  
  <pre><code>from Tkinter import *
  import tkMessageBox
  if ( __name__ == "__main__" ):
          import resources.lib.mechanize as mechanize
          mechanize
  
  # Start Browser
  br = mechanize.Browser(factory=mechanize.RobustFactory())
  
  # User-Agent (Firefox)
  br.addheaders = [('User-agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.6')]
  br.open('http://razetheworld.com/wp-login.php?redirect_to=http%3A%2F%2Frazetheworld.com')
  
  br.select_form(name="loginform")
  br['log'] = 'entryWidget_U must enter here'
  br['pwd'] = 'entryWidget_P must enter here'
  br.submit(name="wp-submit")
  
  print br.geturl()
  
  def displayText():
      """ Display the Entry text value. """
  
      global entryWidget_U
      global entryWidget_P
  
      if entryWidget_U.get().strip() == "":
          tkMessageBox.showerror("Tkinter Entry Widget", "Enter a Username")
      else:
          tkMessageBox.showinfo("Tkinter Entry Widget", "Text value =" + entryWidget_U.get().strip())
  
      if entryWidget_P.get().strip() == "":
          tkMessageBox.showerror("Tkinter Entry Widget", "Enter a Password")
      else:
          tkMessageBox.showinfo("Tkinter Entry Widget", "Text value =" + entryWidget_P.get().strip()) 
  
  if __name__ == "__main__":
  
      root = Tk()
  
      root.title("Tkinter Entry Widget")
      root["padx"] = 40
      root["pady"] = 20       
  
      # Create a text frame to hold the text Label and the Entry widget
      textFrame_U = Frame(root)
      textFrame_P = Frame(root)
  
      #Create a Label in textFrame
      entryLabel = Label(textFrame_U)
      entryLabel["text"] = "Enter Username:"
      entryLabel.pack(side=LEFT)
  
      entryLabel = Label(textFrame_P)
      entryLabel["text"] = "Enter Password:"
      entryLabel.pack(side=LEFT)
  
      # Create an Entry Widget in textFrame
      entryWidget_U = Entry(textFrame_U)
      entryWidget_U["width"] = 50
      entryWidget_U.pack(side=LEFT)
  
      entryWidget_P = Entry(textFrame_P)
      entryWidget_P["width"] = 50
      entryWidget_P.pack(side=LEFT)
  
      textFrame_U.pack()
      textFrame_P.pack()
  
      button = Button(root, text="Login", command=#Run br.submit(name="wp-submit"))
      button.pack() 
  
      root.mainloop()
  </code></pre>