Skip to content

Commit 0aefa5d

Browse files
author
BoboTiG
committed
MSSLinux: use of xrange()
1 parent 7bd295f commit 0aefa5d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mss.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,18 +476,18 @@ def pix(pixel, _resultats={}, b=pack):
476476
This method uses of memoization.
477477
'''
478478
if pixel not in _resultats:
479-
_resultats[pixel] = b(b'<B', (pixel & rmask) >> 16) + \
479+
_resultats[pixel] = b(b'<B', (pixel & rmask) >> 16) + \
480480
b(b'<B', (pixel & gmask) >> 8) + b(b'<B', pixel & bmask)
481481
return _resultats[pixel]
482482

483483
# http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/ImUtil.c#n444
484-
xrange = getattr(__builtins__, 'xrange', range)
485484
rmask = ximage.contents.red_mask
486485
gmask = ximage.contents.green_mask
487486
bmask = ximage.contents.blue_mask
487+
xrange = getattr(__builtins__, 'xrange', range)
488488
get_pix = self.xlib.XGetPixel
489489
pixels = [pix(get_pix(ximage, x, y))
490-
for y in range(height) for x in range(width)]
490+
for y in xrange(height) for x in xrange(width)]
491491
self.image = b''.join(pixels)
492492
#"""
493493

@@ -673,13 +673,13 @@ def on_exists(fname):
673673
print(filename)
674674

675675
print("\nA screenshot to grab them all")
676-
for filename in screenshotter.save(output='full-screenshot.png', screen=-1):
676+
for filename in screenshotter.save(output='fullscreen.png', screen=-1):
677677
print(filename)
678678

679679
print("\nScreenshot of the monitor 1, with callback")
680680
for filename in screenshotter.save(output='mon-%d.png',
681-
screen=1,
682-
callback=on_exists):
681+
screen=1,
682+
callback=on_exists):
683683
print(filename)
684684
except ScreenshotError as ex:
685685
print(ex)

0 commit comments

Comments
 (0)