code: def sleep(self, seconds=0.05, dt=0.01):
          
          t0 = _t.time()
          while _t.time()-t0 < seconds:
              
              # Pause a bit to avoid heavy CPU
              _t.sleep(dt)
              
              # process events
              self.process_events()
docs: A "smooth" version of time.sleep(): waits for the time to pass but
          processes events every dt as well.
          
          Note this requires that the object is either a window or embedded 
          somewhere within a window.