Skip to content

Commit be3fb7b

Browse files
committed
Version 7.0.0
1 parent b05ca23 commit be3fb7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+352
-404
lines changed

CHANGELOG

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ History:
22

33
<see Git checking messages for history>
44

5+
7.0.0 2022/10/27
6+
- added support for Python 3.11
7+
- added support for Python 3.10
8+
- removed support for Python 3.5
9+
- MSS: modernized the code base (types, f-string, ran isort & black)
10+
- MSS: fixed several Sourcery issues
11+
- MSS: fixed typos here, and there
12+
- doc: fixed an error when building with shpinx
13+
514
6.1.0 2020/10/31
615
- MSS: reworked how C functions are initialised
716
- Mac: reduce the number of function calls
@@ -119,14 +128,14 @@ History:
119128
3.0.0 2017/07/06
120129
- big refactor, introducing the ScreenShot class
121130
- MSS: add Numpy array interface support to the Screenshot class
122-
- docs: add OpenCV/Numpy, PIL pixels, FPS
131+
- doc: add OpenCV/Numpy, PIL pixels, FPS
123132

124133
2.0.22 2017/04/29
125134
- new contributors: David Becker, redodo
126135
- MSS: better use of exception mechanism
127136
- Linux: use of hasattr to prevent Exception on early exit
128137
- Mac: take into account extra black pixels added when screen with is not divisible by 16 (fix #14)
129-
- docs: add an example to capture only a part of the screen
138+
- doc: add an example to capture only a part of the screen
130139

131140
2.0.18 2016/12/03
132141
- change license to MIT
@@ -138,7 +147,7 @@ History:
138147
- Linux: skip unused monitors
139148
- Linux: use errcheck instead of deprecated restype with callable (fix #11)
140149
- Linux: fix security issue (reported by Bandit)
141-
- docs: add documentation (fix #10)
150+
- doc: add documentation (fix #10)
142151
- tests: add tests and use Travis CI (fix #9)
143152

144153
2.0.0 2016/06/04
@@ -175,14 +184,14 @@ History:
175184
- MSS: little code review
176185
- Linux: fix monitor count
177186
- tests: remove test-linux binary
178-
- docs: add doc/TESTING
179-
- docs: remove Bonus section from README.rst
187+
- doc: add doc/TESTING
188+
- doc: remove Bonus section from README.rst
180189

181190
0.1.0 2015/04/10
182191
- MSS: fix code with YAPF tool
183192
- Linux: fully functional using Xrandr library
184193
- Linux: code purgation (no more XML files to parse)
185-
- docs: better tests and examples
194+
- doc: better tests and examples
186195

187196
0.0.8 2015/02/04
188197
- new contributors: sergey-vin, Alexander 'thehesiod' Mohr

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
MIT License
2-
Copyright (c) 2016-2020, Mickaël 'Tiger-222' Schoentgen
2+
Copyright (c) 2016-2022, Mickaël 'Tiger-222' Schoentgen
33

44
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
55

appveyor.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,12 @@ platform:
1010
environment:
1111
fast_finish: true
1212
matrix:
13+
- PYTHON_VERSION: 3.11
1314
- PYTHON_VERSION: 3.10
1415
- PYTHON_VERSION: 3.9
1516
- PYTHON_VERSION: 3.8
1617
- PYTHON_VERSION: 3.7
1718
- PYTHON_VERSION: 3.6
18-
- PYTHON_VERSION: 3.5
19-
20-
matrix:
21-
allow_failures:
22-
- PYTHON_VERSION: 3.10
23-
- PYTHON_VERSION: 3.9
2419

2520
init:
2621
# Update Environment Variables based on matrix/platform

docs/source/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919

2020
# General information about the project.
2121
project = "Python MSS"
22-
copyright = "2013-2021, Mickaël 'Tiger-222' Schoentgen & contributors"
22+
copyright = "2013-2022, Mickaël 'Tiger-222' Schoentgen & contributors"
2323
author = "Tiger-222"
2424

2525
# The version info for the project you're documenting, acts as replacement for
2626
# |version| and |release|, also used in various other places throughout the
2727
# built documents.
2828
#
2929
# The short X.Y version.
30-
version = "6.1.0"
30+
version = "7.0.0"
3131

3232
# The full version, including alpha/beta/rc tags.
3333
release = "latest"
@@ -37,7 +37,7 @@
3737
#
3838
# This is also used if you do content translation via gettext catalogs.
3939
# Usually you set "language" from the command line for these cases.
40-
language = None
40+
language = "en"
4141

4242
# List of patterns, relative to source directory, that match files and
4343
# directories to ignore when looking for source files.

docs/source/examples/callback.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,20 @@
44
55
Screenshot of the monitor 1, with callback.
66
"""
7-
87
import os
98
import os.path
109

1110
import mss
1211

1312

14-
def on_exists(fname):
15-
# type: (str) -> None
13+
def on_exists(fname: str) -> None:
1614
"""
1715
Callback example when we try to overwrite an existing screenshot.
1816
"""
1917

2018
if os.path.isfile(fname):
21-
newfile = fname + ".old"
22-
print("{} -> {}".format(fname, newfile))
19+
newfile = f"{fname}.old"
20+
print(f"{fname} -> {newfile}")
2321
os.rename(fname, newfile)
2422

2523

docs/source/examples/custom_cls_image.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,26 @@
44
55
Screenshot of the monitor 1, using a custom class to handle the data.
66
"""
7+
from typing import Any
78

89
import mss
10+
from mss.models import Monitor
11+
from mss.screenshot import ScreenShot
912

1013

11-
class SimpleScreenShot:
14+
class SimpleScreenShot(ScreenShot):
1215
"""
1316
Define your own custom method to deal with screen shot raw data.
1417
Of course, you can inherit from the ScreenShot class and change
1518
or add new methods.
1619
"""
1720

18-
def __init__(self, data, monitor, **kwargs):
21+
def __init__(self, data: bytearray, monitor: Monitor, **_: Any) -> None:
1922
self.data = data
2023
self.monitor = monitor
2124

2225

2326
with mss.mss() as sct:
24-
sct.cls_image = SimpleScreenShot # type: ignore
27+
sct.cls_image = SimpleScreenShot
2528
image = sct.grab(sct.monitors[1])
2629
# ...

docs/source/examples/fps.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
Simple naive benchmark to compare with:
66
https://pythonprogramming.net/game-frames-open-cv-python-plays-gta-v/
77
"""
8-
98
import time
109

1110
import cv2
12-
import mss
1311
import numpy
1412

13+
import mss
14+
1515

16-
def screen_record():
16+
def screen_record() -> int:
1717
try:
1818
from PIL import ImageGrab
1919
except ImportError:
@@ -38,7 +38,7 @@ def screen_record():
3838
return fps
3939

4040

41-
def screen_record_efficient():
41+
def screen_record_efficient() -> int:
4242
# 800x600 windowed mode
4343
mon = {"top": 40, "left": 0, "width": 800, "height": 640}
4444

docs/source/examples/fps_multiprocessing.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@
55
Example using the multiprocessing module to speed-up screen capture.
66
https://github.com/pythonlessons/TensorFlow-object-detection-tutorial
77
"""
8-
98
from multiprocessing import Process, Queue
109

1110
import mss
1211
import mss.tools
1312

1413

15-
def grab(queue):
16-
# type: (Queue) -> None
17-
14+
def grab(queue: Queue) -> None:
1815
rect = {"top": 0, "left": 0, "width": 600, "height": 800}
1916

2017
with mss.mss() as sct:
@@ -25,9 +22,7 @@ def grab(queue):
2522
queue.put(None)
2623

2724

28-
def save(queue):
29-
# type: (Queue) -> None
30-
25+
def save(queue: Queue) -> None:
3126
number = 0
3227
output = "screenshots/file_{}.png"
3328
to_png = mss.tools.to_png
@@ -43,7 +38,7 @@ def save(queue):
4338

4439
if __name__ == "__main__":
4540
# The screenshots queue
46-
queue = Queue() # type: Queue
41+
queue: Queue = Queue()
4742

4843
# 2 processes: one for grabing and one for saving PNG files
4944
Process(target=grab, args=(queue,)).start()

docs/source/examples/from_pil_tuple.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
55
Use PIL bbox style and percent values.
66
"""
7-
87
import mss
98
import mss.tools
109

11-
1210
with mss.mss() as sct:
1311
# Use the 1st monitor
1412
monitor = sct.monitors[1]
@@ -23,7 +21,7 @@
2321
# Grab the picture
2422
# Using PIL would be something like:
2523
# im = ImageGrab(bbox=bbox)
26-
im = sct.grab(bbox) # type: ignore
24+
im = sct.grab(bbox)
2725

2826
# Save it!
2927
mss.tools.to_png(im.rgb, im.size, output="screenshot.png")

docs/source/examples/linux_display_keyword.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
55
Usage example with a specific display.
66
"""
7-
87
import mss
98

10-
119
with mss.mss(display=":0.0") as sct:
1210
for filename in sct.save():
1311
print(filename)

0 commit comments

Comments
 (0)