title: tkinter button in class won't bind to key
body: <p>Total noob can't make tkinter button bind to keyboard.</p>
  
  <p>I've tried to bind they  both in main() and in the <strong>init</strong>().</p>
  
  <p>I've tried bunches of permutations of syntax. Nothing works.</p>
  
  <p>I've tried  around until the button(s) get focus and hitting  then. NOTHING HAPPENS.</p>
  
  <p>Anyone have the secret insider information on how to do it?</p>
  
  <pre><code>from tkinter import *
  from tkinter.ttk import Frame, Button, Style
  
  class Example(Frame):
      def __init__(self):
          super().__init__()
          self.initUI()
          self.btn_convert.bind("&lt;Return&gt;", self.convert)
      # -----------------------------------------------
  
      def convert(self):
          print("enter pressed")
      # -----------------------------------------------
  
      def quit(self):
          self.root.destroy()
          exit()
      # -----------------------------------------------
  
      def initUI(self):
  
          self.master.title("Weight Converter")
          self.pack(fill=BOTH, expand=True)
          self.frame_btn = Frame(self)
          self.frame_btn.pack(fill=BOTH, expand=True, padx=20, pady=5)
          self.btn_convert=Button(self.frame_btn, text="Convert", command=self.convert)
          self.btn_convert.pack(side=LEFT, padx=5, pady=5)
  
          self.btn_close1=Button(self.frame_btn, text="Close", command=quit)
          self.btn_close1.pack(side=LEFT, padx=5, pady=5)
  
  def main():
  
      root = Tk()
      root.geometry("300x250+300+200")
      app = Example()
      root.bind("&lt;Return&gt;", lambda event: root.convert())
      root.mainloop()
  
  
  if __name__ == '__main__':
      main()
  </code></pre>