Skip to content

Commit

Permalink
feat: Changing the background
Browse files Browse the repository at this point in the history
  • Loading branch information
mathealgou committed Aug 24, 2024
1 parent ce5506a commit 593e305
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Binary file modified dist/main.exe
Binary file not shown.
2 changes: 2 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ async def main():
audio_levels=get_audio_levels(),
)
draw(data, root)
except Exception as e:
print(e)
finally:
stop_get_cpu_usage()
stop_get_gpu_usage()
Expand Down
13 changes: 11 additions & 2 deletions screen/custom_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def toggle_menu(self):

def quit(self):
try:
self.master.update()
self.master.update_idletasks()
self.master.quit()
self.master.destroy()
except:
pass
Expand Down Expand Up @@ -99,7 +102,7 @@ def __init__(self, master, **kw):
self.place(x=0, y=0, relwidth=1, relheight=1)
self.lower()

def set_image(self, image):
def set_image(self, image: tk.PhotoImage):
# set the image to be the same size as the window
window_width = self.master.winfo_width()
window_height = self.master.winfo_height()
Expand All @@ -113,5 +116,11 @@ def set_image(self, image):
self.image = self.image.zoom(
math.ceil(window_width / image_width), math.ceil(window_height / image_height))

print("🐍 File: screen/custom_widgets.py | Line: 120 | set_image ~ self.image", self.image)
self.config(image=self.image)
save_config("background_image", self.image.cget("file"))

# print the file path to the console
print("name\n\n", self.image.name)
print("🐍 File: screen/custom_widgets.py | Line: 125 | set_image ~ image.cget",
image.cget("file"))
save_config("background_image", image.cget("file"))

0 comments on commit 593e305

Please sign in to comment.