Skip to content

Commit

Permalink
fix: Pixels model correction (#274)
Browse files Browse the repository at this point in the history
* Changed Pixels model and updated documentation.

* Update screenshot.py

---------

Co-authored-by: Mickaël Schoentgen <contact@tiger-222.fr>
  • Loading branch information
Andon-Li and BoboTiG committed Feb 27, 2024
1 parent 20a24c5 commit 599f86c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ Properties

.. attribute:: pixels

List of RGB tuples.
List of row tuples that contain RGB tuples.

:rtype: list[tuple(int, int, int)]
:rtype: list[tuple(tuple(int, int, int), ...)]

.. attribute:: pos

Expand Down
2 changes: 1 addition & 1 deletion src/mss/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Monitors = List[Monitor]

Pixel = Tuple[int, int, int]
Pixels = List[Pixel]
Pixels = List[Tuple[Pixel, ...]]

CFunctions = Dict[str, Tuple[str, List[Any], Any]]

Expand Down
2 changes: 1 addition & 1 deletion src/mss/screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def pixel(self, coord_x: int, coord_y: int) -> Pixel:
:return tuple: The pixel value as (R, G, B).
"""
try:
return self.pixels[coord_y][coord_x] # type: ignore[return-value]
return self.pixels[coord_y][coord_x]
except IndexError as exc:
msg = f"Pixel location ({coord_x}, {coord_y}) is out of range."
raise ScreenShotError(msg) from exc

0 comments on commit 599f86c

Please sign in to comment.