title: How do you check if a widget has focus in Tkinter?
body: <pre><code>from Tkinter import *
  
  app = Tk()
  text_field = Entry(app)
  text_field.pack()
  app.mainloop()
  </code></pre>
  
  <p>I want to be able to check if <code>text_field</code> is currently selected or focused, so that I know whether or not to do something with its contents when the user presses enter.</p>