【发布时间】:2020-08-10 14:43:36
【问题描述】:
我正在创建一个画家软件,并希望用户在完成创建后能够保存他们的图像,所以我尝试了pygame.image.save(pygame.display.get_surface(), "/home/user/screenshot.png")。我快速绘图并按下我设置的保存图像的键。我看了一下图像,它只保存了空白显示表面,而不是实际绘图的pygame.draw.rect()s。我查看了以下链接:How to capture pygame screen?https://gamedev.stackexchange.com/questions/118372/how-can-i-take-a-screenshot-of-a-certain-part-of-the-screen-in-pygameCan python get the screen shot of a specific window? 等等。我将如何截取整个显示屏的屏幕截图以及绘图?这是我的主循环:
running = True
while running:
updateWindow() # Updates window
clearWindow() # Clears window
checkEvents() # Checks events
redrawItems() # Redraws your drawing
pygame.event.pump()
pygame.display.quit()
pygame.quit()
【问题讨论】:
-
这就是这个问题,Yax P。
标签: python python-3.x pygame screenshot screen-capture