Modifications mineures et création du fichier requirements.txt
This commit is contained in:
parent
84d7df9495
commit
ec974a5697
11
main.py
11
main.py
@ -41,8 +41,8 @@ images = []
|
|||||||
|
|
||||||
|
|
||||||
# Fonction pour charger une image en utilisant un thread
|
# Fonction pour charger une image en utilisant un thread
|
||||||
def load_image(image_path):
|
def load_image(local_image_path):
|
||||||
with Image.open(image_path) as img:
|
with Image.open(local_image_path) as img:
|
||||||
img.thumbnail(screen.get_size())
|
img.thumbnail(screen.get_size())
|
||||||
images.append(pygame.image.fromstring(img.tobytes(), img.size, "RGB"))
|
images.append(pygame.image.fromstring(img.tobytes(), img.size, "RGB"))
|
||||||
|
|
||||||
@ -62,9 +62,10 @@ for image_thread in image_threads:
|
|||||||
|
|
||||||
|
|
||||||
class ImageHandler(FileSystemEventHandler):
|
class ImageHandler(FileSystemEventHandler):
|
||||||
def on_modified(self, event):
|
def on_modified(self, local_event):
|
||||||
if event.src_path.endswith('.jpg') or event.src_path.endswith('.png'):
|
if local_event.src_path.endswith('.jpg') or local_event.src_path.endswith('.png'):
|
||||||
load_image(event.src_path)
|
load_image(local_event.src_path)
|
||||||
|
|
||||||
|
|
||||||
def watch_images_directory():
|
def watch_images_directory():
|
||||||
event_handler = ImageHandler()
|
event_handler = ImageHandler()
|
||||||
|
3
requirements.txt
Normal file
3
requirements.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
pygame~=2.3.0
|
||||||
|
Pillow~=9.5.0
|
||||||
|
watchdog~=3.0.0
|
Loading…
x
Reference in New Issue
Block a user