Baekalfen/PyBoy

How to grab frames from an emulator while it's running?

sayakpaul opened this issue · 2 comments

Hi folks.

pyboy works like a charm. I am a beginner in it and I was wondering if it's possible to grab each frame (or even at a certain frame-rate) from the while not pyboy.tick(): block. Any directions along these lines would be very helpful.

Yes, very much so!

from pyboy import PyBoy
p = PyBoy('ROMS/Tetris.gb')
screen = p.botsupport_manager().screen()
while not pyboy.tick():
    screen.screen_image().show()
    # screen.screen_image().save(...)

screen.screen_image() provides a PIL Image for you.

Very nice!

Thank you for your prompt response.