mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-30 01:50:19 +00:00
@@ -472,6 +472,10 @@ class HumanRendering(
|
|||||||
gym.utils.RecordConstructorArgs.__init__(self)
|
gym.utils.RecordConstructorArgs.__init__(self)
|
||||||
gym.Wrapper.__init__(self, env)
|
gym.Wrapper.__init__(self, env)
|
||||||
|
|
||||||
|
self.screen_size = None
|
||||||
|
self.window = None # Has to be initialized before asserts, as self.window is used in auto close
|
||||||
|
self.clock = None
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
self.env.render_mode in self.ACCEPTED_RENDER_MODES
|
self.env.render_mode in self.ACCEPTED_RENDER_MODES
|
||||||
), f"Expected env.render_mode to be one of {self.ACCEPTED_RENDER_MODES} but got '{env.render_mode}'"
|
), f"Expected env.render_mode to be one of {self.ACCEPTED_RENDER_MODES} but got '{env.render_mode}'"
|
||||||
@@ -479,10 +483,6 @@ class HumanRendering(
|
|||||||
"render_fps" in self.env.metadata
|
"render_fps" in self.env.metadata
|
||||||
), "The base environment must specify 'render_fps' to be used with the HumanRendering wrapper"
|
), "The base environment must specify 'render_fps' to be used with the HumanRendering wrapper"
|
||||||
|
|
||||||
self.screen_size = None
|
|
||||||
self.window = None
|
|
||||||
self.clock = None
|
|
||||||
|
|
||||||
if "human" not in self.metadata["render_modes"]:
|
if "human" not in self.metadata["render_modes"]:
|
||||||
self.metadata = deepcopy(self.env.metadata)
|
self.metadata = deepcopy(self.env.metadata)
|
||||||
self.metadata["render_modes"].append("human")
|
self.metadata["render_modes"].append("human")
|
||||||
|
@@ -31,6 +31,11 @@ class HumanRendering(VectorWrapper):
|
|||||||
"""
|
"""
|
||||||
VectorWrapper.__init__(self, env)
|
VectorWrapper.__init__(self, env)
|
||||||
|
|
||||||
|
self.screen_size = screen_size
|
||||||
|
self.scaled_subenv_size, self.num_rows, self.num_cols = None, None, None
|
||||||
|
self.window = None # Has to be initialized before asserts, as self.window is used in auto close
|
||||||
|
self.clock = None
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
self.env.render_mode in self.ACCEPTED_RENDER_MODES
|
self.env.render_mode in self.ACCEPTED_RENDER_MODES
|
||||||
), f"Expected env.render_mode to be one of {self.ACCEPTED_RENDER_MODES} but got '{env.render_mode}'"
|
), f"Expected env.render_mode to be one of {self.ACCEPTED_RENDER_MODES} but got '{env.render_mode}'"
|
||||||
@@ -38,11 +43,6 @@ class HumanRendering(VectorWrapper):
|
|||||||
"render_fps" in self.env.metadata
|
"render_fps" in self.env.metadata
|
||||||
), "The base environment must specify 'render_fps' to be used with the HumanRendering wrapper"
|
), "The base environment must specify 'render_fps' to be used with the HumanRendering wrapper"
|
||||||
|
|
||||||
self.screen_size = screen_size
|
|
||||||
self.scaled_subenv_size, self.num_rows, self.num_cols = None, None, None
|
|
||||||
self.window = None
|
|
||||||
self.clock = None
|
|
||||||
|
|
||||||
if "human" not in self.metadata["render_modes"]:
|
if "human" not in self.metadata["render_modes"]:
|
||||||
self.metadata = deepcopy(self.env.metadata)
|
self.metadata = deepcopy(self.env.metadata)
|
||||||
self.metadata["render_modes"].append("human")
|
self.metadata["render_modes"].append("human")
|
||||||
|
Reference in New Issue
Block a user