Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jobs:
- emoji: 🪟
runs-on: [windows-latest]
python:
- name: CPython 3.9
runs-on: "3.9"
- name: CPython 3.10
runs-on: "3.10"
- name: CPython 3.11
Expand Down
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ See Git checking messages for full history.

## 10.0.0 (2024-xx-xx)
- removed support for Python 3.8
- removed support for Python 3.9
- added support for Python 3.14
- :heart: contributors: @

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ with mss() as sct:

An ultra-fast cross-platform multiple screenshots module in pure python using ctypes.

- **Python 3.10+**, PEP8 compliant, no dependency, thread-safe;
- **Python 3.9+**, PEP8 compliant, no dependency, thread-safe;
- very basic, it will grab one screenshot by monitor or a screenshot of all monitors and save it to a PNG file;
- but you can use PIL and benefit from all its formats (or add yours directly);
- integrate well with Numpy and OpenCV;
Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/pil_pixels.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
img = Image.new("RGB", sct_img.size)

# Best solution: create a list(tuple(R, G, B), ...) for putdata()
pixels = zip(sct_img.raw[2::4], sct_img.raw[1::4], sct_img.raw[::4], strict=False)
pixels = zip(sct_img.raw[2::4], sct_img.raw[1::4], sct_img.raw[::4])
img.putdata(list(pixels))

# But you can set individual pixels too (slower)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Welcome to Python MSS's documentation!

An ultra fast cross-platform multiple screenshots module in pure python using ctypes.

- **Python 3.10+**, :pep:`8` compliant, no dependency, thread-safe;
- **Python 3.9+**, :pep:`8` compliant, no dependency, thread-safe;
- very basic, it will grab one screenshot by monitor or a screenshot of all monitors and save it to a PNG file;
- but you can use PIL and benefit from all its formats (or add yours directly);
- integrate well with Numpy and OpenCV;
Expand Down
3 changes: 1 addition & 2 deletions docs/source/support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Support
Feel free to try MSS on a system we had not tested, and let us know by creating an `issue <https://github.com/BoboTiG/python-mss/issues>`_.

- OS: GNU/Linux, macOS and Windows
- Python: 3.10 and newer
- Python: 3.9 and newer


Future
Expand Down Expand Up @@ -35,4 +35,3 @@ Abandoned
- Python 3.6 (2022-10-27)
- Python 3.7 (2023-04-09)
- Python 3.8 (2024-09-01)
- Python 3.9 (2024-09-01)
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "mss"
description = "An ultra fast cross-platform multiple screenshots module in pure python using ctypes."
readme = "README.md"
requires-python = ">= 3.10"
requires-python = ">= 3.9"
authors = [
{ name = "Mickaël Schoentgen", email="[email protected]" },
]
Expand All @@ -31,6 +31,7 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand Down Expand Up @@ -149,7 +150,7 @@ exclude = [
]
line-length = 120
indent-width = 4
target-version = "py310"
target-version = "py39"

[tool.ruff.lint]
extend-select = ["ALL"]
Expand Down
6 changes: 4 additions & 2 deletions src/mss/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ def __init__(
/,
*,
compression_level: int = 6,
display: bytes | str | None = None, # noqa:ARG002 Linux only
max_displays: int = 32, # noqa:ARG002 Mac only
with_cursor: bool = False,
# Linux only
display: bytes | str | None = None, # noqa: ARG002
# Mac only
max_displays: int = 32, # noqa: ARG002
) -> None:
self.cls_image: type[ScreenShot] = ScreenShot
self.compression_level = compression_level
Expand Down
4 changes: 2 additions & 2 deletions src/mss/screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def left(self) -> int:
def pixels(self) -> Pixels:
""":return list: RGB tuples."""
if not self.__pixels:
rgb_tuples: Iterator[Pixel] = zip(self.raw[2::4], self.raw[1::4], self.raw[::4], strict=False)
self.__pixels = list(zip(*[iter(rgb_tuples)] * self.width, strict=False))
rgb_tuples: Iterator[Pixel] = zip(self.raw[2::4], self.raw[1::4], self.raw[::4])
self.__pixels = list(zip(*[iter(rgb_tuples)] * self.width))

return self.__pixels

Expand Down
4 changes: 2 additions & 2 deletions src/tests/test_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def main(*args: str, ret: int = 0) -> None:
assert os.path.isfile("monitor-1.png")
os.remove("monitor-1.png")

for opts in zip(["-m 1", "--monitor=1"], ["-q", "--quiet"], strict=False):
for opts in zip(["-m 1", "--monitor=1"], ["-q", "--quiet"]):
main(*opts)
captured = capsys.readouterr()
assert not captured.out
Expand All @@ -128,7 +128,7 @@ def main(*args: str, ret: int = 0) -> None:
main(opt, fmt)
captured = capsys.readouterr()
with mss.mss(display=os.getenv("DISPLAY")) as sct:
for mon, (monitor, line) in enumerate(zip(sct.monitors[1:], captured.out.splitlines(), strict=False), 1):
for mon, (monitor, line) in enumerate(zip(sct.monitors[1:], captured.out.splitlines()), 1):
filename = fmt.format(mon=mon, **monitor)
assert line.endswith(filename)
assert os.path.isfile(filename)
Expand Down