From d7c6226eb7888415ff2726b6746489c4eafa7c96 Mon Sep 17 00:00:00 2001 From: Roland Pereira <52257639+pereiraroland26@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:53:25 +0530 Subject: [PATCH] updated button widths on popup --- modules/ui.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/modules/ui.py b/modules/ui.py index f1a59959..a8c65226 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -29,14 +29,17 @@ POPUP_SCROLL_WIDTH = 740, POPUP_SCROLL_HEIGHT = 700 -POPUP_LIVE_WIDTH = 950 +POPUP_LIVE_WIDTH = 900 POPUP_LIVE_HEIGHT = 820 -POPUP_LIVE_SCROLL_WIDTH = 940, +POPUP_LIVE_SCROLL_WIDTH = 890, POPUP_LIVE_SCROLL_HEIGHT = 700 MAPPER_PREVIEW_MAX_HEIGHT = 100 MAPPER_PREVIEW_MAX_WIDTH = 100 +DEFAULT_BUTTON_WIDTH = 200 +DEFAULT_BUTTON_HEIGHT = 40 + RECENT_DIRECTORY_SOURCE = None RECENT_DIRECTORY_TARGET = None RECENT_DIRECTORY_OUTPUT = None @@ -194,7 +197,7 @@ def on_button_click(map, button_num): for item in map: id = item['id'] - button = ctk.CTkButton(scrollable_frame, text="Select source image", command=lambda id=id: on_button_click(map, id)) + button = ctk.CTkButton(scrollable_frame, text="Select source image", command=lambda id=id: on_button_click(map, id), width=DEFAULT_BUTTON_WIDTH, height=DEFAULT_BUTTON_HEIGHT) button.grid(row=id, column=0, padx=50, pady=10) x_label = ctk.CTkLabel(scrollable_frame, text=f"X", width=MAPPER_PREVIEW_MAX_WIDTH, height=MAPPER_PREVIEW_MAX_HEIGHT) @@ -559,14 +562,14 @@ def on_tbutton_click(map, button_num): for item in map: id = item['id'] - button = ctk.CTkButton(scrollable_frame, text="Select source image", command=lambda id=id: on_sbutton_click(map, id)) - button.grid(row=id, column=0, padx=50, pady=10) + button = ctk.CTkButton(scrollable_frame, text="Select source image", command=lambda id=id: on_sbutton_click(map, id), width=DEFAULT_BUTTON_WIDTH, height=DEFAULT_BUTTON_HEIGHT) + button.grid(row=id, column=0, padx=30, pady=10) x_label = ctk.CTkLabel(scrollable_frame, text=f"X", width=MAPPER_PREVIEW_MAX_WIDTH, height=MAPPER_PREVIEW_MAX_HEIGHT) x_label.grid(row=id, column=2, padx=10, pady=10) - button = ctk.CTkButton(scrollable_frame, text="Select target image", command=lambda id=id: on_tbutton_click(map, id)) - button.grid(row=id, column=3, padx=40, pady=10) + button = ctk.CTkButton(scrollable_frame, text="Select target image", command=lambda id=id: on_tbutton_click(map, id), width=DEFAULT_BUTTON_WIDTH, height=DEFAULT_BUTTON_HEIGHT) + button.grid(row=id, column=3, padx=20, pady=10) if "source" in item: image = Image.fromarray(cv2.cvtColor(item['source']['cv2'], cv2.COLOR_BGR2RGB)) @@ -583,7 +586,7 @@ def on_tbutton_click(map, button_num): tk_image = ctk.CTkImage(image, size=image.size) target_image = ctk.CTkLabel(scrollable_frame, text=f"T-{id}", width=MAPPER_PREVIEW_MAX_WIDTH, height=MAPPER_PREVIEW_MAX_HEIGHT) - target_image.grid(row=id, column=4, padx=10, pady=10) + target_image.grid(row=id, column=4, padx=20, pady=10) target_image.configure(image=tk_image) @@ -652,7 +655,7 @@ def update_webcam_target(scrollable_frame: ctk.CTkScrollableFrame, map: list, bu tk_image = ctk.CTkImage(image, size=image.size) target_image = ctk.CTkLabel(scrollable_frame, text=f"T-{button_num}", width=MAPPER_PREVIEW_MAX_WIDTH, height=MAPPER_PREVIEW_MAX_HEIGHT) - target_image.grid(row=button_num, column=4, padx=10, pady=10) + target_image.grid(row=button_num, column=4, padx=20, pady=10) target_image.configure(image=tk_image) target_label_dict_live[button_num] = target_image else: