Skip to content

Commit ab3fc19

Browse files
author
BoboTiG
committed
Change the way output filenames are chosen
1 parent f0dfab9 commit ab3fc19

2 files changed

Lines changed: 15 additions & 22 deletions

File tree

‎README.rst‎

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,23 @@ Or simply import the good one::
4242
from mss import MSSLinux as mss_class
4343

4444

45-
init(debug=False)
46-
-----------------
45+
init(debug)
46+
-----------
4747

4848
When initialising an instance of MSS, you can enable debug output::
4949

5050
mss = mss_class(debug=True)
5151

5252

53-
save(output='screenshot', screen=-1, callback=lambda *x: True)
54-
--------------------------------------------------------------
53+
save(output, screen, callback)
54+
------------------------------
5555

5656
For each monitor, grab a screen shot and save it to a file.
5757

5858
Parameters::
5959

60-
output - string - the output filename without extension
60+
output - string - the output filename. It can contain '%d' which
61+
will be replaced by the monitor number.
6162
screen - integer - grab one screen shot of all monitors (screen=-1)
6263
grab one screen shot by monitor (screen=0)
6364
grab the screen shot of the monitor N (screen=N)
@@ -67,14 +68,7 @@ Parameters::
6768
continue; else ignores the monitor and
6869
switches to ne next.
6970

70-
This is a generator which returns created files::
71-
72-
'screenshot-1.png',
73-
'screenshot-2.png',
74-
...,
75-
'screenshot-N.png'
76-
or
77-
'screenshot-full.png'
71+
This is a generator which returns created files.
7872

7973

8074
Examples

‎mss.py‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,16 @@ def get_pixels(self, monitor_infos):
202202
'''
203203
return NotImplemented
204204

205-
def save(self, output='screenshot', screen=0, callback=lambda *x: True):
205+
def save(self,
206+
output='screenshot-%d.png',
207+
screen=0,
208+
callback=lambda *x: True
209+
):
206210
''' For each monitor, grab a screen shot and save it to a file.
207211
208212
Parameters:
209-
- output - string - the output filename without extension
213+
- output - string - the output filename. It can contain '%d' which
214+
will be replaced by the monitor number.
210215
- screen - int - grab one screen shot of all monitors (screen=-1)
211216
grab one screen shot by monitor (screen=0)
212217
grab the screen shot of the monitor N (screen=N)
@@ -216,13 +221,7 @@ def save(self, output='screenshot', screen=0, callback=lambda *x: True):
216221
continue; else ignores the monitor and
217222
switches to ne next.
218223
219-
This is a generator which returns created files:
220-
'screenshot-1.png',
221-
'screenshot-2.png',
222-
...,
223-
'screenshot-N.png'
224-
or
225-
'screenshot-full.png'
224+
This is a generator which returns created files.
226225
'''
227226

228227
self.debug('save')

0 commit comments

Comments
 (0)