Created
September 11, 2018 00:40
-
-
Save thomelane/79e97630ba46c45985a946cae4805885 to your computer and use it in GitHub Desktop.
OpenAI Gym render in Jupyter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gym | |
from IPython import display | |
import matplotlib | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
env = gym.make('Breakout-v0') | |
env.reset() | |
img = plt.imshow(env.render(mode='rgb_array')) # only call this once | |
for _ in range(100): | |
img.set_data(env.render(mode='rgb_array')) # just update the data | |
display.display(plt.gcf()) | |
display.clear_output(wait=True) | |
action = env.action_space.sample() | |
env.step(action) |
This code gives me 'int' object is not subscriptable
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is really slow in comparison with the default rendering technique. Also in my case (Windows 10 anaconda) it also opens an ipykernel_launcher