class_docstr: Performs human rendering for an environment that only supports "rgb_array"rendering.
  
  This wrapper is particularly useful when you have implemented an environment that can produce
  RGB images but haven't implemented any code to render the images to the screen.
  If you want to use this wrapper with your environments, remember to specify ``"render_fps"``
  in the metadata of your environment.
  
  The ``render_mode`` of the wrapped environment must be either ``'rgb_array'`` or ``'rgb_array_list'``.
  
  Example:
      >>> env = gym.make("LunarLander-v2", render_mode="rgb_array")
      >>> wrapped = HumanRendering(env)
      >>> wrapped.reset()     # This will start rendering to the screen
  
  The wrapper can also be applied directly when the environment is instantiated, simply by passing
  ``render_mode="human"`` to ``make``. The wrapper will only be applied if the environment does not
  implement human-rendering natively (i.e. ``render_mode`` does not contain ``"human"``).
  
  Example:
      >>> env = gym.make("NoNativeRendering-v2", render_mode="human")      # NoNativeRendering-v0 doesn't implement human-rendering natively
      >>> env.reset()     # This will start rendering to the screen
  
  Warning: If the base environment uses ``render_mode="rgb_array_list"``, its (i.e. the *base environment's*) render method
      will always return an empty list:
  
          >>> env = gym.make("LunarLander-v2", render_mode="rgb_array_list")
          >>> wrapped = HumanRendering(env)
          >>> wrapped.reset()
          >>> env.render()
          []          # env.render() will always return an empty list!
class_docstr_tok: ["Performs","human","rendering","for","an","environment","that","only","supports","``","rgb_array","''","rendering",".","This","wrapper","is","particularly","useful","when","you","have","implemented","an","environment","that","can","produce","RGB","images","but","have","n't","implemented","any","code","to","render","the","images","to","the","screen",".","If","you","want","to","use","this","wrapper","with","your","environments",",","remember","to","specify","``","``","render_fps","''","``","in","the","metadata","of","your","environment",".","The","``","render_mode","``","of","the","wrapped","environment","must","be","either","``","'rgb_array","'","``","or","``","'rgb_array_list","'","``",".","Example",":",">",">",">","env","=","gym.make","(","``","LunarLander-v2","''",",","render_mode=","''","rgb_array","''",")",">",">",">","wrapped","=","HumanRendering","(","env",")",">",">",">","wrapped.reset","(",")","#","This","will","start","rendering","to","the","screen","The","wrapper","can","also","be","applied","directly","when","the","environment","is","instantiated",",","simply","by","passing","``","render_mode=","''","human","''","``","to","``","make","``",".","The","wrapper","will","only","be","applied","if","the","environment","does","not","implement","human-rendering","natively","(","i.e",".","``","render_mode","``","does","not","contain","``","``","human","''","``",")",".","Example",":",">",">",">","env","=","gym.make","(","``","NoNativeRendering-v2","''",",","render_mode=","''","human","''",")","#","NoNativeRendering-v0","does","n't","implement","human-rendering","natively",">",">",">","env.reset","(",")","#","This","will","start","rendering","to","the","screen","Warning",":","If","the","base","environment","uses","``","render_mode=","''","rgb_array_list","''","``",",","its","(","i.e",".","the","*","base","environment","'s","*",")","render","method","will","always","return","an","empty","list",":",">",">",">","env","=","gym.make","(","``","LunarLander-v2","''",",","render_mode=","''","rgb_array_list","''",")",">",">",">","wrapped","=","HumanRendering","(","env",")",">",">",">","wrapped.reset","(",")",">",">",">","env.render","(",")","[","]","#","env.render","(",")","will","always","return","an","empty","list","!"]
docstr: Initialize a :class:`HumanRendering` instance.
  
  Args:
      env: The environment that is being wrapped
docstr_tok: ["Initialize","a",":","class",":","`","HumanRendering","`","instance",".","Args",":","env",":","The","environment","that","is","being","wrapped"]
code: def __init__(self, env):
      """Initialize a :class:`HumanRendering` instance.
  
      Args:
          env: The environment that is being wrapped
      """
      super().__init__(env)
      assert env.render_mode in [
          "rgb_array",
          "rgb_array_list",
      ], f"Expected env.render_mode to be one of 'rgb_array' or 'rgb_array_list' but got '{env.render_mode}'"
      assert (
          "render_fps" in env.metadata
      ), "The base environment must specify 'render_fps' to be used with the HumanRendering wrapper"
  
      self.screen_size = None
      self.window = None
      self.clock = None
  
file_path: gym/gym/wrappers/human_rendering.py
imports: import numpy
  import gym
  from gym.error import DependencyNotInstalled
label_desc: Use image node_id 1 to create a new HumanRendering object from inherited base classes: gym with example: obj = HumanRendering(env)