From 74f6804d620fe827ae6b45e758f4c7381641684d Mon Sep 17 00:00:00 2001 From: Kinadinova Dariya <dariya.kinadinova.etu@115p4.fil.univ-lille.fr> Date: Wed, 27 Mar 2024 13:16:00 +0100 Subject: [PATCH] class Block: init, is_uniform --- projet/Block.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/projet/Block.py b/projet/Block.py index b8c1127..4ee55d6 100644 --- a/projet/Block.py +++ b/projet/Block.py @@ -8,8 +8,17 @@ from PIL import Image, ImageDraw class Block: def __init__(self, image): + """à_remplacer_par_ce_que_fait_la_fonction + + Précondition : + Exemple(s) : + $$$ + + """ + self.image = image + self.width, self.height = image.size - def is_uniform_block(self, image): + def is_uniform(self, coordinates: tuple()): """à_remplacer_par_ce_que_fait_la_fonction Précondition : @@ -17,5 +26,12 @@ class Block: $$$ """ + x, y = coordinates + if all(self.image.getpixel((x, y)) == self.image.getpixel((x1, y1)) for x in range(self.width) for y in range(self.height)): + return True + else: + return False + + -- GitLab