From c948fbd0d0a7b81e348fb6caecca4be3d79f4eb4 Mon Sep 17 00:00:00 2001 From: csd4ni3l Date: Sat, 13 Dec 2025 16:13:09 +0100 Subject: [PATCH] Fix preload paths not using the base module path --- utils/preload.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/utils/preload.py b/utils/preload.py index ea7bbcf..cd0269f 100644 --- a/utils/preload.py +++ b/utils/preload.py @@ -1,7 +1,10 @@ -import arcade.gui, arcade +import arcade.gui, arcade, os -button_texture = arcade.gui.NinePatchTexture(64 // 4, 64 // 4, 64 // 4, 64 // 4, arcade.load_texture("assets/graphics/button.png")) -button_hovered_texture = arcade.gui.NinePatchTexture(64 // 4, 64 // 4, 64 // 4, 64 // 4, arcade.load_texture("assets/graphics/button_hovered.png")) +# Get the directory where this module is located +_module_dir = os.path.dirname(os.path.abspath(__file__)) +_assets_dir = os.path.join(os.path.dirname(_module_dir), 'assets') -with open("assets/mit_wordlist.txt", "r") as file: +button_texture = arcade.gui.NinePatchTexture(64 // 4, 64 // 4, 64 // 4, 64 // 4, arcade.load_texture(os.path.join(_assets_dir, 'graphics', 'button.png'))) +button_hovered_texture = arcade.gui.NinePatchTexture(64 // 4, 64 // 4, 64 // 4, 64 // 4, arcade.load_texture(os.path.join(_assets_dir, 'graphics', 'button_hovered.png'))) +with open(os.path.join(_assets_dir, "mit_wordlist.txt"), "r") as file: words = [word.strip() for word in file.readlines()] \ No newline at end of file