set image min width

This commit is contained in:
faroukbmiled 2023-09-25 23:00:20 +01:00
parent 74f3b46926
commit 5d6f7ab03f
2 changed files with 7 additions and 8 deletions

View File

@ -744,13 +744,11 @@ class LibraryTab(ctk.CTkScrollableFrame):
ratings.pack(side="right", padx=(10, 20), pady=(10, 10)) ratings.pack(side="right", padx=(10, 20), pady=(10, 10))
image_label = ctk.CTkLabel(image_frame) image_label = ctk.CTkLabel(image_frame)
width, height = image_size max_width = 300
i_width, i_height = tuple([int(max_width/image_size[0] * x) for x in image_size])
# preview image is too big if offline, // to round floats # preview image is too big if offline, // to round floats
if width > 1000 or height > 1000:
width = width // 2
height = height // 2
image_widget = ctk.CTkImage(image, size=(int(width), int(height))) image_widget = ctk.CTkImage(image, size=(int(i_width), int(i_height)))
image_label.configure(image=image_widget, text="") image_label.configure(image=image_widget, text="")
image_label.pack(expand=True, fill="both", padx=(10, 20), pady=(10, 10)) image_label.pack(expand=True, fill="both", padx=(10, 20), pady=(10, 10))
@ -796,7 +794,7 @@ class LibraryTab(ctk.CTkScrollableFrame):
top.after(10, top.focus_force) top.after(10, top.focus_force)
for button_view in self.button_view_list: for button_view in self.button_view_list:
button_view.configure(state="normal") button_view.configure(state="normal")
self.after(0, main_thread) main_app.app.after(0, main_thread)
@if_internet_available @if_internet_available
def check_for_updates(self, on_launch=False): def check_for_updates(self, on_launch=False):

View File

@ -757,8 +757,9 @@ class BOIIIWD(ctk.CTk):
ratings.pack(side="right", padx=(10, 20), pady=(10, 10)) ratings.pack(side="right", padx=(10, 20), pady=(10, 10))
image_label = ctk.CTkLabel(image_frame) image_label = ctk.CTkLabel(image_frame)
width, height = image_size max_width = 300
image_widget = ctk.CTkImage(image, size=(int(width), int(height))) i_width, i_height = tuple([int(max_width/image_size[0] * x) for x in image_size])
image_widget = ctk.CTkImage(image, size=(int(i_width), int(i_height)))
image_label.configure(image=image_widget, text="") image_label.configure(image=image_widget, text="")
image_label.pack(expand=True, fill="both", padx=(10, 20), pady=(10, 10)) image_label.pack(expand=True, fill="both", padx=(10, 20), pady=(10, 10))