Skip to content

Commit b521d6b

Browse files
committed
Doc: homogenize examples names
1 parent 2b9673a commit b521d6b

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

docs/source/examples.rst

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@ Basics
77

88
One screenshot per monitor::
99

10-
for filename in screenshotter.save():
10+
for filename in sct.save():
1111
print(filename)
1212

1313

1414
Screenshot of the monitor 1::
1515

16-
next(screenshotter.save(mon=1))
16+
for filename in sct.save(mon=1):
17+
print(filename)
1718

1819

1920
A screenshot to grab them all::
2021

21-
next(screenshotter.save(mon=-1, output='fullscreen.png'))
22+
for filename in sct.save(mon=-1, output='fullscreen.png')):
23+
print(filename)
2224

2325

2426
Callback
@@ -39,7 +41,9 @@ Screenshot of the monitor 1 with callback::
3941
rename(fname, newfile)
4042
return True
4143

42-
next(screenshotter.save(mon=1, callback=on_exists))
44+
45+
for filename in sct.save(mon=1, callback=on_exists):
46+
print(filename)
4347

4448

4549
Into the Python's console
@@ -48,7 +52,7 @@ Into the Python's console
4852
::
4953

5054
>>> from mss import mss
51-
>>> sct = mss(display=':0')
55+
>>> sct = mss()
5256

5357
# Retrieve monitors informations
5458
>>> displays = sct.enum_display_monitors()
@@ -76,8 +80,7 @@ Into the Python's console
7680
StopIteration
7781

7882
# Save pixels to a PNG file: option 2
79-
>>> mon = displays[1]
80-
>>> sct.to_png(data=pixels, width=mon['width'], height=mon['height'], output='monitor-1.png')
83+
>>> sct.to_png(data=pixels, output='monitor-1.png')
8184

8285

8386
GNU/Linux
@@ -92,8 +95,8 @@ On GNU/Linux, you can specify which display to use (useful for distant screensho
9295
print('Screenshot of display "{0}"'.format(display))
9396
output = 'monitor{0}-%d.png'.format(display)
9497

95-
with MSS(display=display) as screenshotter:
96-
for filename in screenshotter.save(output=output):
98+
with MSS(display=display) as sct:
99+
for filename in sct.save(output=output):
97100
print(filename)
98101

99102

@@ -107,21 +110,19 @@ This is an example using `frombytes() <http://pillow.readthedocs.io/en/latest/re
107110
from PIL import Image
108111

109112

110-
with mss() as screenshotter:
113+
with mss() as sct:
111114
# We retrieve monitors informations:
112-
monitors = screenshotter.enum_display_monitors()
115+
monitors = sct.enum_display_monitors()
113116

114117
# Get rid of the first, as it represents the "All in One" monitor:
115118
for num, monitor in enumerate(monitors[1:], 1):
116119
# Get raw pixels from the screen.
117120
# This method will store screen size into `width` and `height`
118121
# and raw pixels into `image`.
119-
screenshotter.get_pixels(monitor)
122+
sct.get_pixels(monitor)
120123

121124
# Create an Image:
122-
img = Image.frombytes('RGB',
123-
(screenshotter.width, screenshotter.height),
124-
screenshotter.image)
125+
img = Image.frombytes('RGB', (sct.width, sct.height), sct.image)
125126

126127
# And save it!
127128
img.save('monitor-{0}.jpg'.format(num))

docs/source/usage.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ So MSS can be used as simply as::
1010
from mss import mss
1111

1212

13-
Or import the good one::
13+
Or import the good one base on your operating system::
1414

1515
# MacOS X
1616
from mss.darwin import MSS as mss
@@ -27,9 +27,9 @@ Instance
2727

2828
So the module can be used as simply as::
2929

30-
with mss() as screenshotter:
30+
with mss() as sct:
3131
# ...
3232

3333
Or::
3434

35-
screenshotter = mss()
35+
sct = mss()

0 commit comments

Comments
 (0)