title: How do I quit a keyboard event in Tkinter?
body: <p>I want to make a keyboard quick operation command.When I press 'b',print 'b';and When I press 's',print 's' .Here is my code:</p>
  
  <pre><code># -*- coding: utf-8 -*-
  from Tkinter import *
  import tkFont
  
  root = Tk()
  
  def pri(event):
      print event.char
  
  def rb():
      root.bind('&lt;KeyPress-b&gt;',pri)
      root.bind('&lt;KeyPress-s&gt;',pri)
  
  v = IntVar()
  def callbackcheck():
      if v.get():
          rb()
  Cb = Checkbutton(root,variable = v,text = 'Hello',onvalue = 1,offvalue  = 0,command = callbackcheck)
  Cb.pack()
  
  root.mainloop()
  </code></pre>
  
  <p>When I set the Checkbutton 'on',keyboard event is activated.But when I set the Checkbutton 'off',keyboard event can't quit and when I press 'b',still print 'b'.Actually,keyboard event always run once it was activated.And I don't know how to quit keyboard event.Do you have any ideas?</p>
  
  <p>Next is a similar question:
  When I use entry in Tkinter,I just want input numbers,not letters,and I find a way to use <code>validateCommand</code>.But I can't quit the entry widget when I click other area in current window or input letters.I want to exit the entry widget when I click other widget or input letters,how can I achieve this goal?</p>