diff --git a/dm2gym/envs/dm_suite_env.py b/dm2gym/envs/dm_suite_env.py index 5d725fa..c51b7d5 100644 --- a/dm2gym/envs/dm_suite_env.py +++ b/dm2gym/envs/dm_suite_env.py @@ -68,7 +68,7 @@ def render(self, mode='human', **kwargs): from gym.envs.classic_control import rendering self.viewer = rendering.SimpleImageViewer(maxwidth=1024) else: - from dm2gym import OpenCVImageViewer + from . import OpenCVImageViewer self.viewer = OpenCVImageViewer() self.viewer.imshow(img) return self.viewer.isopen diff --git a/dm2gym/envs/opencv_image_viewer.py b/dm2gym/envs/opencv_image_viewer.py index acb90f4..7d22c95 100644 --- a/dm2gym/envs/opencv_image_viewer.py +++ b/dm2gym/envs/opencv_image_viewer.py @@ -10,6 +10,7 @@ class OpenCVImageViewer(): This class is meant to be a drop-in replacement for `gym.envs.classic_control.rendering.SimpleImageViewer` """ + def __init__(self, *, escape_to_exit=False): """Construct the viewing window""" self._escape_to_exit = escape_to_exit @@ -29,8 +30,11 @@ def imshow(self, img): # Listen for escape key, then exit if pressed if cv2.waitKey(1) in [27] and self._escape_to_exit: exit() - + @property def isopen(self): """Is the window open?""" return self._isopen + + def close(self): + pass