Skip to content

Commit 6bc03f0

Browse files
committed
Merge pull request kivy#2662 from kivy/pygame_scr
Window.screenshot python 3 fix
2 parents b49d7f2 + e6079c9 commit 6bc03f0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kivy/core/window/window_pygame.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,10 @@ def screenshot(self, *largs, **kwargs):
260260
GL_UNSIGNED_BYTE)
261261
width, height = self.system_size
262262
data = glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE)
263-
data = str(buffer(data))
263+
if PY2:
264+
data = str(buffer(data))
265+
else:
266+
data = bytes(bytearray(data))
264267
surface = pygame.image.fromstring(data, (width, height), 'RGBA', True)
265268
pygame.image.save(surface, filename)
266269
Logger.debug('Window: Screenshot saved at <%s>' % filename)

0 commit comments

Comments
 (0)