openai / procgen

Procgen Benchmark: Procedurally-Generated Game-Like Gym-Environments

Home Page:https://openai.com/blog/procgen-benchmark/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can't close the render window

bionicles opened this issue · comments

what's the correct way to close the render window after an episode?

tried:

env.close()
env.render(close=True)
del env

the examples just run in a standalone script which closes after it's done, but most folks would run this in a function in a loop, the window staying open clutters the screen

got it working, albeit differently, like this:

import matplotlib.pyplot as plt

# ... before the episode:
if "procgen" in env_name:
    plt.ion()
    plt.show()

# ... during the loop:
if "procgen" in env_name:
    plt.clf()
    plt.imshow(info["rgb"])
    plt.pause(1 / 144)

# ... after the episode:
if "procgen" in env_name:
    plt.close()

other envs work like this, can we implement this api?

# ... during the loop:
    env.render()

# ... after the episode:
env.close()

My bad, just saw the gym3 design doc re: no render method. I figured it out so ill close this