def zoom(self, factor):
    """Zoom the window in/out."""
    self._window_scale *= factor
    if time.time() - self._last_zoom_time < 1:
      # Avoid a deadlock in pygame if you zoom too quickly.
      time.sleep(time.time() - self._last_zoom_time)
    self.init_window()
    self._last_zoom_time = time.time()