Baekalfen / PyBoy

Game Boy emulator written in Python
Other
4.62k stars 475 forks source link

Pyboy screenshotting function? #248

Closed mapl-e closed 1 year ago

mapl-e commented 1 year ago

Is there any function that allows me to take a screenshot of the running game? I would be really thankful if anyone helps.

Baekalfen commented 1 year ago

It's actually on the frontpage in the readme:


from pyboy import WindowEvent

pyboy.send_input(WindowEvent.PRESS_ARROW_DOWN)
pyboy.tick() # Process one frame to let the game register the input
pyboy.send_input(WindowEvent.RELEASE_ARROW_DOWN)

pil_image = pyboy.screen_image()
pil_image.save('screenshot.png')```
mapl-e commented 1 year ago

Does this take a screenshot of the game tab? Or does it take a screenshot of the whole system? Thank you for your help btw!!