You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating system (e.g. Windows, Linux(Debian), Linux(Ubuntu), Mac): Mac
Python version (e.g. 3.7.9, 3.8.5) : 3.9
SDL version (e.g. SDL 2.0.12): 2.26.4
PyGame version (e.g. 2.0.0.dev10, 1.9.6): 2.4.0 (and 2.1.3)
Relevant hardware (e.g. if reporting a bug about a controller, tell us the brand & name of it):
Current behavior:
I'm part of the development team of OpenAI Gym and Gymnasium and would like users to be able to use pygame in jupyter notebook.
We are able to open a window in jupyter notebook however pygame.quit doesn't cause the window to close and the kernel will hang and close
Expected behavior:
To be able to close a pygame windows in jupyter notebook
Steps to reproduce:
pip install gymnasium[classic_control]
importgymnasiumasgymenv=gym.make("LunarLander-v2", render_mode="human")
observation, info=env.reset()
for_inrange(100):
action=env.action_space.sample()
observation, reward, terminated, truncated, info=env.step(action)
ifterminatedortruncated:
observation, info=env.reset()
env.close() # This includes `pygame.quit()`
I have tested this is issue with pygame using the following basic script
importpygamewin=pygame.display.set_mode((500,500))
pygame.display.set_caption("First Game")
run=Truewhilerun:
pygame.time.delay(100)
# handle eventsforeventinpygame.event.get():
ifevent.type==pygame.QUIT:
run=False# clear the disaplywin.fill(0)
# draw the scenefilled_rect=pygame.Rect(100, 100, 25, 25)
pygame.draw.rect(win, (0,0,255), filled_rect)
# update the dispalypygame.display.update()
pygame.quit()
The text was updated successfully, but these errors were encountered:
Environment:
Current behavior:
I'm part of the development team of OpenAI Gym and Gymnasium and would like users to be able to use pygame in jupyter notebook.
We are able to open a window in jupyter notebook however
pygame.quit
doesn't cause the window to close and the kernel will hang and closeExpected behavior:
To be able to close a pygame windows in jupyter notebook
Steps to reproduce:
pip install gymnasium[classic_control]
I have tested this is issue with pygame using the following basic script
The text was updated successfully, but these errors were encountered: