Skip to content

Commit

Permalink
updated button widths on popup
Browse files Browse the repository at this point in the history
  • Loading branch information
pereiraroland26 committed Sep 10, 2024
1 parent eb140e5 commit d7c6226
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions modules/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand All @@ -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)


Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit d7c6226

Please sign in to comment.