You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+48-28Lines changed: 48 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,39 @@ A cross-platform multi-screen shot module in pure python using ctypes
4
4
5
5
Very basic, it will grab one screen shot by monitor or a screen shot of all monitors and save it to a PNG file, Python 2.6/3.5 compatible & PEP8 compliant.
6
6
7
-
So, while you can `pip install --upgrade mss`, you may just drop it in your project and forget about it.
8
-
9
-
MSS stands for Multi-Screen Shot.
7
+
MSS stands for Multiple ScreenShots.
10
8
11
9
It's under zlib licence.
12
10
13
11
12
+
Installation
13
+
============
14
+
15
+
You can install it with pip::
16
+
17
+
pip install --upgrade mss
18
+
19
+
Or you may just drop it in your project and forget about it.
20
+
21
+
Support
22
+
-------
23
+
24
+
========= ========= ======== =======
25
+
Python GNU/linux Mac OS X Windows
26
+
========= ========= ======== =======
27
+
3.5.0a3 True True True
28
+
**3.4.3** **True** **True** **True**
29
+
3.3.6 True True True
30
+
3.2.6 True True True
31
+
3.1.5 True True True
32
+
3.0.1 True True True
33
+
**2.7.9** **True** **True** **True**
34
+
2.6.9 True True True
35
+
========= ========= ======== =======
36
+
37
+
Feel free to try MSS on a system we had not tested, and let report us by creating an [issue](https://github.com/BoboTiG/python-mss/issues).
38
+
39
+
14
40
Testing
15
41
=======
16
42
@@ -22,35 +48,29 @@ You can try the MSS module directly from the console::
22
48
Instance the good class
23
49
=======================
24
50
25
-
You can determine automatically which class to use::
26
-
27
-
from platform import system
28
-
import mss
51
+
So MSS can be used as simply as::
29
52
30
-
systems = {
31
-
'Darwin': mss.MSSMac,
32
-
'Linux': mss.MSSLinux,
33
-
'Windows': mss.MSSWindows
34
-
}
35
-
mss_class = systems[system()]()
53
+
from mss import mss
54
+
screenshotter = mss()
36
55
37
-
Or simply import the good one::
56
+
Or import the good one::
38
57
39
-
from mss import MSSLinux as mss_class
58
+
from mss import MSSLinux as mss
59
+
screenshotter = mss()
40
60
41
61
42
62
save(output, screen, callback)
43
63
------------------------------
44
64
45
-
For each monitor, grab a screen shot and save it to a file.
65
+
For each monitor, grab a screenshot and save it to a file.
46
66
47
67
Parameters::
48
68
49
69
output - string - the output filename. It can contain '%d' which
50
70
will be replaced by the monitor number.
51
-
screen - integer - grab one screen shot of all monitors (screen=-1)
52
-
grab one screen shot by monitor (screen=0)
53
-
grab the screen shot of the monitor N (screen=N)
71
+
screen - integer - grab one screenshot of all monitors (screen=-1)
72
+
grab one screenshot by monitor (screen=0)
73
+
grab the screenshot of the monitor N (screen=N)
54
74
callback - function - in case where output already exists, call
55
75
the defined callback function with output
56
76
as parameter. If it returns True, then
@@ -63,21 +83,21 @@ This is a generator which returns created files.
63
83
Examples
64
84
========
65
85
66
-
One screen shot per monitor::
86
+
One screenshot per monitor::
67
87
68
-
for filename in mss.save():
88
+
for filename in screenshotter.save():
69
89
print(filename)
70
90
71
-
Screen shot of the monitor 1::
91
+
Screenshot of the monitor 1::
72
92
73
-
for filename in mss.save(screen=1):
93
+
for filename in screenshotter.save(screen=1):
74
94
print(filename)
75
95
76
-
Screen shot of the monitor 1, with callback::
96
+
Screenshot of the monitor 1, with callback::
77
97
78
98
def on_exists(fname):
79
99
''' Callback example when we try to overwrite an existing
80
-
screen shot.
100
+
screenshot.
81
101
'''
82
102
from os import rename
83
103
from os.path import isfile
@@ -87,10 +107,10 @@ Screen shot of the monitor 1, with callback::
87
107
rename(fname, newfile)
88
108
return True
89
109
90
-
for filename in mss.save(screen=1, callback=on_exists):
110
+
for filename in screenshotter.save(screen=1, callback=on_exists):
91
111
print(filename)
92
112
93
-
A shot to grab them all (fullscreen shot)::
113
+
A screenshot to grab them all::
94
114
95
-
for filename in mss.save(output='fullscreen-shot.png', screen=-1):
115
+
for filename in screenshotter.save(output='fullscreen-shot.png', screen=-1):
0 commit comments