How to use the glfw.destroy_window function in glfw

To help you get started, we’ve selected a few glfw examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deepmind / dm_control / dm_control / _render / glfw_renderer.py View on Github external
def _platform_init(self, max_width, max_height):
    """Initializes this context.

    Args:
      max_width: Integer specifying the maximum framebuffer width in pixels.
      max_height: Integer specifying the maximum framebuffer height in pixels.
    """
    glfw.window_hint(glfw.VISIBLE, 0)
    glfw.window_hint(glfw.DOUBLEBUFFER, 0)
    self._context = glfw.create_window(width=max_width, height=max_height,
                                       title='Invisible window', monitor=None,
                                       share=None)
    # This reference prevents `glfw.destroy_window` from being garbage-collected
    # before the last window is destroyed, otherwise we may get
    # `AttributeError`s when the `__del__` method is later called.
    self._destroy_window = glfw.destroy_window
github deepmind / dm_control / dm_control / viewer / gui / glfw_gui.py View on Github external
def _platform_init(self, width, height):
    glfw.window_hint(glfw.SAMPLES, 4)
    glfw.window_hint(glfw.VISIBLE, 1)
    glfw.window_hint(glfw.DOUBLEBUFFER, 1)
    self._context = glfw.create_window(width, height, self._title, None, None)
    self._destroy_window = glfw.destroy_window
github rlworkgroup / metaworld / scripts / demo_sawyer.py View on Github external
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)
github rlworkgroup / metaworld / scripts / demo_sawyer.py View on Github external
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)
github psychopy / psychopy / psychopy / visual / backends / glfwbackend.py View on Github external
def close(self):
        """Close the window and uninitialize the resources
        """
        # Test if the window has already been closed
        if glfw.window_should_close(self.winHandle):
            return

        _hw_handle = None

        try:
            self.setMouseVisibility(True)
            glfw.set_window_should_close(self.winHandle, 1)
            glfw.destroy_window(self.winHandle)
        except Exception:
            pass
        # If iohub is running, inform it to stop looking for this win id
        # when filtering kb and mouse events (if the filter is enabled of
        # course)
        try:
            if IOHUB_ACTIVE and _hw_handle:
                from psychopy.iohub.client import ioHubConnection
                conn = ioHubConnection.ACTIVE_CONNECTION
                conn.unregisterWindowHandles(_hw_handle)
        except Exception:
            pass
github rlworkgroup / metaworld / scripts / demo_sawyer.py View on Github external
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)
github rlworkgroup / metaworld / metaworld / envs / mujoco / mujoco_env.py View on Github external
def close(self):
		if self.viewer is not None:
			glfw.destroy_window(self.viewer.window)
			self.viewer = None
github tangrams / tangram-es / swig / examples / map.py View on Github external
def teardown(self):
        if self.m:
            self.m.teardown()
            self.m = None

        if self.window:
            glfw.destroy_window(self.window)
            self.window = None
github AIRLab-POLIMI / mushroom / mushroom / environments / mujoco.py View on Github external
def stop(self):
        if self.viewer is not None:
            v = self.viewer
            self.viewer = None
            glfw.destroy_window(v.window)
            del v