From c3a8d67e1fab546635d074c51fe12de6aa302bbe Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 12 Feb 2024 19:46:18 -0300 Subject: Add a fallback if the images cannot be loaded (making the exe standalone) --- __main__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to '__main__.py') diff --git a/__main__.py b/__main__.py index 9e15e4a..bd116bf 100755 --- a/__main__.py +++ b/__main__.py @@ -719,8 +719,13 @@ root=tk.Tk() root.title("Mana Launcher (tk)") ## Initialize the images -_cog_png = tk.PhotoImage(file = "cog.png") -_favicon = tk.PhotoImage(file = "favicon.png") +try: + _cog_png = tk.PhotoImage(file = "cog.png") + _favicon = tk.PhotoImage(file = "favicon.png") +except: + from _img import __cog, __favicon + _cog_png = tk.PhotoImage(data = __cog) + _favicon = tk.PhotoImage(data = __favicon) root.iconphoto(True, _favicon) canva = tk.Canvas(root, width=400, height=600, bg="#0c3251") -- cgit v1.2.3-60-g2f50