Skip to content

Render window size too large and cannot be closed #500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
moonmoondog opened this issue Oct 28, 2023 · 1 comment
Open

Render window size too large and cannot be closed #500

moonmoondog opened this issue Oct 28, 2023 · 1 comment

Comments

@moonmoondog
Copy link

import gym
env = gym.make('ALE/Assault-v5', render_mode='human')
state, info = env.reset()
for i in range(50): env.step(1)
env.reset()
env.close()

When the code above get executed, the rendering is normal.
However, the popped up window has a much larger resolution than my screen and cannot be resized.
In addition to that, after rendering, reset() and close() are called as suggested by the document.
But the popped up window would not close similar to the following issue. #499
IPython platform needs to be closed to get rid of the window.

I have:
ale-py 0.8.1
gym 0.26.2
IPython 8.16.1
OS Arch Linux

ale_rendering

@physcat
Copy link

physcat commented Mar 14, 2025

While we wait for a fix, as a workaround you can use the HumanRendering wrapper like this:

import gymnasium as gym
import ale_py
from gymnasium.wrappers import HumanRendering

with HumanRendering(gym.make("ALE/Assault-v5", render_mode='rgb_array')) as env:
    obs, info = env.reset()

    for _ in range(500):
        action = env.action_space.sample()
        obs, reward, terminated, truncated, info = env.step(action)
        
        if terminated or truncated:
            obs, info = env.reset()

This will be small, if you really need scaling for a demo, you can create your own version of HumarnRendering with a copy of the original's _render_frame with a scaling factor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants