title: Python tkInter Entry fun
body: <p>Playing around with Python - tkInter - Entry widget - when I use validatecommand (below), the check happens the first time the string > Max, but when I continue to enter text the check steps - there's no delete or insert after the first time?  Any advice? (outside of not building a desktop app via python)</p>
  
  <hr>
  
  <pre><code>#!/usr/bin/env python
  from Tkinter import *
  
  class MyEntry(Entry):
  
      def __init__(self, master, maxchars):
          Entry.__init__(self, master, validate = "key",    validatecommand=self.validatecommand)
          self.MAX = maxchars
  
      def validatecommand(self, *args):
          if len(self.get()) &gt;= self.MAX:
              self.delete(0,3)
              self.insert(0, "no")
          return True
  
  if __name__ == '__main__':
      tkmain = Tk()
      e = MyEntry(tkmain, 5)
      e.grid()
      tkmain.mainloop()
  </code></pre>