From b47738b424f561fd4ef435b5e65260ff01ca4b99 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 8 Oct 2023 12:36:17 +0900 Subject: [PATCH] [bugfix] Config Window: Dropdown Menu Window. Set the maximum height to be 8 times the label's height, and adjust it if the value's length is less than 8. --- vrct_gui/_CreateDropdownMenuWindow.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/vrct_gui/_CreateDropdownMenuWindow.py b/vrct_gui/_CreateDropdownMenuWindow.py index 25b10479..32dbf738 100644 --- a/vrct_gui/_CreateDropdownMenuWindow.py +++ b/vrct_gui/_CreateDropdownMenuWindow.py @@ -43,8 +43,6 @@ class _CreateDropdownMenuWindow(CTkToplevel): # self.rowconfigure(0,weight=1) # self.columnconfigure(0,weight=1) - # The color code [#bb4448] is a mixture of [#a9555c] and [#cc3333] (for a redder shade). - def updateDropdownMenuValues(self, dropdown_menu_widget_id, dropdown_menu_values): self.dropdown_menu_widgets[dropdown_menu_widget_id].widget.destroy() self.createDropdownMenuBox( @@ -121,15 +119,16 @@ class _CreateDropdownMenuWindow(CTkToplevel): # ______________________________________ dropdown_menu_values_length = len(dropdown_menu_values) - if dropdown_menu_values_length <= 3: - self.scroll_frame_container.configure(width=200, height=int(dropdown_menu_values_length * label_height)) - # self.geometry("{}x{}".format(300, int(dropdown_menu_values_length * label_height))) - # self.geometry("{}x{}".format(300, int(dropdown_menu_values_length * label_height))) - # self.scroll_frame_container._parent_canvas.configure(height=20) + new_height = 200 + new_width = 200 + max_display_length = 8 + if dropdown_menu_values_length < max_display_length: + new_height = int(dropdown_menu_values_length * label_height) + # new_width = 200 else: - self.scroll_frame_container.configure(width=200, height=200) - # self.geometry("{}x{}".format(200, 200)) - # self.scroll_frame_container._parent_canvas.configure(height=20) + new_height = int(max_display_length * label_height) + + self.scroll_frame_container.configure(width=new_width, height=new_height) # This is for CustomTkinter's spec change or bug fix. self.scroll_frame_container._scrollbar.configure(height=0)