Search code examples
pythonarcade

Window Screenshot Python Arcade Library


How does one take a screenshot of the current window using the Python Arcade library?

I have built a simulator using the Python Arcade library and would like to take a screenshot of the window programmatically when interesting events occur. Is this possible?


Solution

  • arcade.draw_commands.get_image(x=0, y=0, width=None, height=None)
    

    Get an image from the screen. You can save the image like:

    image = get_image()
    image.save('screenshot.png', 'PNG')
    

    Source