How to capture pygame screen?

前端 未结 1 1733
轮回少年
轮回少年 2020-12-15 23:31

How can I capture and save a sequence of images or a video of a pygame screen?
Basically I want to share my game video on youtube. Also, want to make a tutorial.

1条回答
  •  执念已碎
    2020-12-16 00:04

    Use pygame.image.save on your screen surface:

    window = pygame.display.set_mode(...)
    
    ...
    
    pygame.image.save(window, "screenshot.jpeg")
    

    Note that this will slow down your program tremendously. If it is time-based, you may wish to fake the framerate when doing a capture.

    0 讨论(0)
提交回复
热议问题