mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-02 06:16:32 +00:00
pyglet 1.4 compatibility (#1771)
* pyglet 1.4 compatibility * change pyglet version in setup.py
This commit is contained in:
@@ -403,7 +403,7 @@ class CarRacing(gym.Env, EzPickle):
|
||||
return self.viewer.isopen
|
||||
|
||||
image_data = pyglet.image.get_buffer_manager().get_color_buffer().get_image_data()
|
||||
arr = np.fromstring(image_data.data, dtype=np.uint8, sep='')
|
||||
arr = np.fromstring(image_data.get_data(), dtype=np.uint8, sep='')
|
||||
arr = arr.reshape(VP_H, VP_W, 4)
|
||||
arr = arr[::-1, :, 0:3]
|
||||
|
||||
|
@@ -102,7 +102,7 @@ class Viewer(object):
|
||||
if return_rgb_array:
|
||||
buffer = pyglet.image.get_buffer_manager().get_color_buffer()
|
||||
image_data = buffer.get_image_data()
|
||||
arr = np.frombuffer(image_data.data, dtype=np.uint8)
|
||||
arr = np.frombuffer(image_data.get_data(), dtype=np.uint8)
|
||||
# In https://github.com/openai/gym-http-api/issues/2, we
|
||||
# discovered that someone using Xmonad on Arch was having
|
||||
# a window of size 598 x 398, though a 600 x 400 window
|
||||
@@ -144,7 +144,7 @@ class Viewer(object):
|
||||
self.window.flip()
|
||||
image_data = pyglet.image.get_buffer_manager().get_color_buffer().get_image_data()
|
||||
self.window.flip()
|
||||
arr = np.fromstring(image_data.data, dtype=np.uint8, sep='')
|
||||
arr = np.fromstring(image_data.get_data(), dtype=np.uint8, sep='')
|
||||
arr = arr.reshape(self.height, self.width, 4)
|
||||
return arr[::-1,:,0:3]
|
||||
|
||||
|
2
setup.py
2
setup.py
@@ -28,7 +28,7 @@ setup(name='gym',
|
||||
if package.startswith('gym')],
|
||||
zip_safe=False,
|
||||
install_requires=[
|
||||
'scipy', 'numpy>=1.10.4', 'six', 'pyglet>=1.2.0,<=1.3.2', 'cloudpickle~=1.2.0',
|
||||
'scipy', 'numpy>=1.10.4', 'six', 'pyglet>=1.4.0,<=1.5.0', 'cloudpickle~=1.2.0',
|
||||
'enum34~=1.1.6;python_version<"3.4"',
|
||||
],
|
||||
extras_require=extras,
|
||||
|
Reference in New Issue
Block a user