From 3bdbfe4f26b7eb23b36dd9108de95d0dc479104e Mon Sep 17 00:00:00 2001 From: alexkummerer Date: Wed, 26 Jun 2024 12:11:06 +0200 Subject: [PATCH] Adding File ErrorHandling --- SudokuGUI.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SudokuGUI.py b/SudokuGUI.py index 6c0d923..6fa3c1e 100644 --- a/SudokuGUI.py +++ b/SudokuGUI.py @@ -294,8 +294,12 @@ def main(): screen = pygame.display.set_mode((540, 590)) screen.fill((255, 255, 255)) pygame.display.set_caption("Sudoku Solver") - icon = pygame.image.load("assets/thumbnail.png") - pygame.display.set_icon(icon) + + try: + icon = pygame.image.load("assets/thumbnail.png") + pygame.display.set_icon(icon) + except FileNotFoundError: + print("Warning: Icon file 'assets/thumbnail.png' not found. Proceeding without setting the window icon.") # Display "Generating Random Grid" text while generating a random grid font = pygame.font.SysFont("Bahnschrift", 40)