(self, environment_loader, policy=None)
Starts the viewer with the specified policy and environment.

    Args:
      environment_loader: Either a callable that takes no arguments and returns
        an instance of dm_control.rl.control.Environment, or an instance of
        dm_control.rl.control.Environment.
      policy: An optional callable corresponding to a policy to execute
        within the environment. It should accept a `TimeStep` and return
        a numpy array of actions conforming to the output of
        `environment.action_spec()`.

    Raises:
      ValueError: If `environment_loader` is None.
Starts the viewer with the specified policy and environment.
Starts the viewer with the specified policy and environment .
def launch(self, environment_loader, policy=None):
    """Starts the viewer with the specified policy and environment.

    Args:
      environment_loader: Either a callable that takes no arguments and returns
        an instance of dm_control.rl.control.Environment, or an instance of
        dm_control.rl.control.Environment.
      policy: An optional callable corresponding to a policy to execute
        within the environment. It should accept a `TimeStep` and return
        a numpy array of actions conforming to the output of
        `environment.action_spec()`.

    Raises:
      ValueError: If `environment_loader` is None.
    """
    if environment_loader is None:
      raise ValueError('"environment_loader" argument is required.')
    if callable(environment_loader):
      self._environment_loader = environment_loader
    else:
      self._environment_loader = lambda: environment_loader
    self._policy = policy
    self._load_environment(zoom_to_scene=True)
    def tick():
      self._viewport.set_size(*self._window.shape)
      self._tick()
      return self._renderer.pixels
    self._window.event_loop(tick_func=tick)
    self._window.close()
def launch ( self , environment_loader , policy = None ) : if environment_loader is None : raise ValueError ( '"environment_loader" argument is required.' ) if callable ( environment_loader ) : self . _environment_loader = environment_loader else : self . _environment_loader = lambda : environment_loader self . _policy = policy self . _load_environment ( zoom_to_scene = True ) def tick ( ) : self . _viewport . set_size ( * self . _window . shape ) self . _tick ( ) return self . _renderer . pixels self . _window . event_loop ( tick_func = tick ) self . _window . close ( )