File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,6 @@ You can try the MSS module directly from the console::
18
18
19
19
python mss.py
20
20
21
- Passing the `--debug ` argument will make it more verbose.
22
-
23
21
24
22
Instance the good class
25
23
=======================
@@ -34,7 +32,8 @@ You can determine automatically which class to use::
34
32
'Linux': mss.MSSLinux,
35
33
'Windows': mss.MSSWindows
36
34
}
37
- mss_class = systems[system()]
35
+ mss_class = systems[system()]()
36
+ #mss_class.DEBUG = True
38
37
39
38
Or simply import the good one::
40
39
@@ -86,11 +85,15 @@ Screen shot of the monitor 1::
86
85
Screen shot of the monitor 1, with callback::
87
86
88
87
def on_exists(fname):
89
- ''' Callback example when we try to overwrite an existing screen shot. '''
88
+ ''' Callback example when we try to overwrite an existing
89
+ screen shot.
90
+ '''
90
91
from os import rename
91
- newfile = fname + '.old'
92
- print('Renaming "{}" to "{}"'.format(fname, newfile))
93
- rename(fname, newfile)
92
+ from os.path import isfile
93
+ if isfile(fname):
94
+ newfile = fname + '.old'
95
+ print('{} -> {}'.format(fname, newfile))
96
+ rename(fname, newfile)
94
97
return True
95
98
96
99
for filename in mss.save(screen=1, callback=on_exists):
You can’t perform that action at this time.
0 commit comments