Python glfw.destroy_window() Examples
The following are 25
code examples of glfw.destroy_window().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
glfw
, or try the search function
.
Example #1
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_push_multiobj(): env = SawyerTwoObjectEnv() env.reset() for _ in range(50): env.render() env.step(env.action_space.sample()) time.sleep(0.05) glfw.destroy_window(env.viewer.window)
Example #2
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_window_open(): env = SawyerWindowOpenEnv() env.reset() for _ in range(100): env.render() env.step(np.array([1, 0, 0, 1])) time.sleep(0.05) glfw.destroy_window(env.viewer.window)
Example #3
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_window_close(): env = SawyerWindowCloseEnv() env.reset() for _ in range(100): env.render() env.step(np.array([1, 0, 0, 1])) time.sleep(0.05) glfw.destroy_window(env.viewer.window)
Example #4
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_throw(): env = SawyerThrowEnv() for i in range(1000): if i % 100 == 0: env.reset() env.step(np.array([0, 0, 0, 1])) env.render() glfw.destroy_window(env.viewer.window)
Example #5
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_sweep_into_goal(): env = SawyerSweepIntoGoalEnv(fix_goal=True) for i in range(1000): if i % 100 == 0: env.reset() env.step(np.array([0, 1, 1])) env.render() glfw.destroy_window(env.viewer.window)
Example #6
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_sweep(): env = SawyerSweepEnv(fix_goal=True) for i in range(200): if i % 100 == 0: env.reset() env.step(env.action_space.sample()) env.render() glfw.destroy_window(env.viewer.window)
Example #7
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_stick_pull(): env = SawyerStickPullEnv() env.reset() for _ in range(100): env.render() env.step(env.action_space.sample()) time.sleep(0.05) glfw.destroy_window(env.viewer.window)
Example #8
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_stack(): env = SawyerStackEnv() env.reset() for _ in range(50): env.render() env.step(env.action_space.sample()) time.sleep(0.05) glfw.destroy_window(env.viewer.window)
Example #9
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_shelf_place(): env = SawyerShelfPlaceEnv() env.reset() for _ in range(100): env.render() env.step(env.action_space.sample()) time.sleep(0.05) glfw.destroy_window(env.viewer.window)
Example #10
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_rope(): env = SawyerRopeEnv() env.reset() for _ in range(50): env.render() env.step(env.action_space.sample()) time.sleep(0.05) glfw.destroy_window(env.viewer.window)
Example #11
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_reach_push_pick_place(): env = SawyerReachPushPickPlaceEnv() for i in range(100): if i % 100 == 0: env.reset() env.step(np.array([0, 1, 1])) env.render() glfw.destroy_window(env.viewer.window)
Example #12
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_reach(): env = SawyerReachXYZEnv() for i in range(100): if i % 100 == 0: env.reset() env.step(np.array([0, 1, 1])) env.render() glfw.destroy_window(env.viewer.window)
Example #13
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_push_nips(): env = SawyerPushAndReachXYEasyEnv() for _ in range(100): env.render() env.step(env.action_space.sample()) time.sleep(0.05) glfw.destroy_window(env.viewer.window)
Example #14
Source File: mujoco_py_renderer.py From robosuite with MIT License | 5 votes |
def close(self): """ Destroys the open window and renders (pun intended) the viewer useless. """ glfw.destroy_window(self.viewer.window) self.viewer = None
Example #15
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_push_multiobj(): env = SawyerTwoObjectEnv() for _ in range(100): env.render() env.step(np.array([0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5])) time.sleep(0.05) glfw.destroy_window(env.viewer.window)
Example #16
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_push_and_reach_two_pucks(): env = SawyerPushAndReachXYZDoublePuckEnv() env.reset() for i in range(100): env.render() env.set_goal({'state_desired_goal': np.array([1, 1, 1, 1, 1, 1, 1])}) env.step(env.action_space.sample()) glfw.destroy_window(env.viewer.window)
Example #17
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_pick_and_place_wsg(): env = SawyerPickAndPlaceWsgEnv() env.reset() for _ in range(100): env.render() env.step(np.array([0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5])) time.sleep(0.05) glfw.destroy_window(env.viewer.window)
Example #18
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_pick_and_place(): env = SawyerPickAndPlaceEnv() env.reset() for _ in range(50): env.render() env.step(env.action_space.sample()) time.sleep(0.05) glfw.destroy_window(env.viewer.window)
Example #19
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def sample_sawyer_pick_and_place(): env = SawyerPickAndPlaceEnv() env.reset() for _ in range(200): env.render() env.step(env.action_space.sample()) time.sleep(0.05) glfw.destroy_window(env.viewer.window)
Example #20
Source File: demo_sawyer.py From metaworld with MIT License | 5 votes |
def close(env): if env.viewer is not None: # self.viewer.finish() glfw.destroy_window(env.viewer.window) env.viewer = None
Example #21
Source File: mujoco_env.py From metaworld with MIT License | 5 votes |
def close(self): if self.viewer is not None: glfw.destroy_window(self.viewer.window) self.viewer = None
Example #22
Source File: glfw_app.py From pyopenvr with BSD 3-Clause "New" or "Revised" License | 5 votes |
def dispose_gl(self): if self.window: glfw.make_context_current(self.window) if self.renderer: self.renderer.dispose_gl() glfw.destroy_window(self.window) glfw.terminate() self._is_initialized = False
Example #23
Source File: mujoco.py From mushroom-rl with MIT License | 5 votes |
def stop(self): if self.viewer is not None: v = self.viewer self.viewer = None glfw.destroy_window(v.window) del v
Example #24
Source File: base.py From gym-sawyer with MIT License | 5 votes |
def _close_mjviewer_window(self): """ Close the MjViewer window. Unfortunately, the gym environments using MuJoCo don't close the viewer windows properly, which leads to "out of memory" issues when several of these environments are tested one after the other. This method searches for the viewer object of type MjViewer, and if the environment is wrapped in other environment classes, it performs depth search in those as well. This method can be removed once OpenAI solves the issue. """ if self.env.spec: if any(package in self.env.spec._entry_point for package in KNOWN_GYM_NOT_CLOSE_VIEWER): # This import is not in the header to avoid a MuJoCo dependency # with non-MuJoCo environments that use this base class. from mujoco_py.mjviewer import MjViewer if (hasattr(self.env, "viewer") and isinstance(self.env.viewer, MjViewer)): glfw.destroy_window(self.env.viewer.window) else: env_itr = self.env while hasattr(env_itr, "env"): env_itr = env_itr.env if (hasattr(env_itr, "viewer") and isinstance(env_itr.viewer, MjViewer)): glfw.destroy_window(env_itr.viewer.window) break
Example #25
Source File: garage_env.py From garage with MIT License | 5 votes |
def _close_viewer_window(self): """Close viewer window. Unfortunately, some gym environments don't close the viewer windows properly, which leads to "out of memory" issues when several of these environments are tested one after the other. This method searches for the viewer object of type MjViewer, Viewer or SimpleImageViewer, based on environment, and if the environment is wrapped in other environment classes, it performs depth search in those as well. This method can be removed once OpenAI solves the issue. """ # We need to do some strange things here to fix-up flaws in gym # pylint: disable=import-outside-toplevel if self.env.spec: if any(package in getattr(self.env.spec, 'entry_point', '') for package in KNOWN_GYM_NOT_CLOSE_MJ_VIEWER): # This import is not in the header to avoid a MuJoCo dependency # with non-MuJoCo environments that use this base class. try: from mujoco_py.mjviewer import MjViewer import glfw except ImportError: # If we can't import mujoco_py, we must not have an # instance of a class that we know how to close here. return if (hasattr(self.env, 'viewer') and isinstance(self.env.viewer, MjViewer)): glfw.destroy_window(self.env.viewer.window) elif any(package in getattr(self.env.spec, 'entry_point', '') for package in KNOWN_GYM_NOT_CLOSE_VIEWER): if hasattr(self.env, 'viewer'): from gym.envs.classic_control.rendering import ( Viewer, SimpleImageViewer) if (isinstance(self.env.viewer, (SimpleImageViewer, Viewer))): self.env.viewer.close()