diff --git a/mujoco_py/mjviewer.py b/mujoco_py/mjviewer.py index cf9ed6e3..18e0c5db 100644 --- a/mujoco_py/mjviewer.py +++ b/mujoco_py/mjviewer.py @@ -63,8 +63,7 @@ def key_callback(self, window, key, scancode, action, mods): if action == glfw.RELEASE and key == glfw.KEY_ESCAPE: print("Pressed ESC") print("Quitting.") - glfw.terminate() - sys.exit(0) + glfw.set_window_should_close(window, 1) def _cursor_pos_callback(self, window, xpos, ypos): if not (self._button_left_pressed or self._button_right_pressed):