title: How do I .bind Enterkey <Return> to a button only if inside textbox?
body: <p>I have A Note Taking Program and currently I can type in a Keyword in TextBox-1 and hit Enter to get my notes displayed in a TextBox-2.</p>
  
  <p>The only way I can find how to bind Enter  to a button is for it to always be bound to that button. Or I can bind Enter to a function. I would rather have it bound to the button/function only if I am currently inside textBox-1.</p>
  
  <p>I don't even know if it is possible because I can not find any references to something similar to my needs.</p>
  
  <p>Currently I have my Enter key bound like this:</p>
  
  <pre><code>root.bind('&lt;Return&gt;', kw_entry)
  </code></pre>
  
  <p>This calls the function kw_entry when I hit Enter.</p>
  
  <pre><code>def kw_entry(event=None):
      e1Current = keywordEntry.get().lower()
      if e1Current in notes:  # e1Corrent is just the current text in TextBox-1
          root.text.delete(1.0, END)
          root.text.insert(tkinter.END, notes[e1Current])
          root.text.see(tkinter.END)
      else:
          root.text.delete(1.0, END)
          root.text.insert(tkinter.END, "Not a Keyword")
          root.text.see(tkinter.END)
  </code></pre>
  
  <p>For the most part this works fine however I also want to edit the notes being displayed and the problem is I can not hit Enter while in TextBox-2 because Enter is bound to call the function kw_entry. This is a problem because it resets everything in TextBox-2.</p>
  
  <p>Can anyone point me in the right direction?</p>