Skip to content

Commit f415bbb

Browse files
list box width
1 parent b9e504b commit f415bbb

2 files changed

Lines changed: 17 additions & 12 deletions

File tree

Python_Engine/Python/src/python_toolkit/bhom_tkinter/widgets/list_box.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ def __init__(
1717
parent: ttk.Frame,
1818
items=None,
1919
selectmode=tk.MULTIPLE,
20-
height=None,
20+
height=None,
21+
width=None,
2122
show_selection_controls=False,
2223
**kwargs):
2324
"""
@@ -26,6 +27,7 @@ def __init__(
2627
items (list, optional): List of items to populate the listbox.
2728
selectmode (str): Selection mode for the listbox (SINGLE, MULTIPLE, etc.).
2829
height (int, optional): Height of the listbox. Defaults to number of items.
30+
width (int, optional): Width of the listbox in characters. If None, listbox expands to fill available space.
2931
show_selection_controls (bool): Show Select All and Deselect All buttons.
3032
**kwargs: Additional Frame options.
3133
"""
@@ -44,13 +46,16 @@ def __init__(
4446
self.content_frame.rowconfigure(1, weight=1)
4547

4648
# Create listbox
47-
self.listbox = tk.Listbox(
48-
self.content_frame,
49-
selectmode=selectmode,
50-
height=height,
51-
yscrollcommand=self.scrollbar.set,
52-
exportselection=False,
53-
)
49+
listbox_options = {
50+
"selectmode": selectmode,
51+
"height": height,
52+
"yscrollcommand": self.scrollbar.set,
53+
"exportselection": False,
54+
}
55+
if width is not None:
56+
listbox_options["width"] = width
57+
58+
self.listbox = tk.Listbox(self.content_frame, **listbox_options)
5459
self.listbox.grid(row=0, column=0, columnspan=2, sticky="nsew")
5560
self.scrollbar.config(command=self.listbox.yview)
5661

Python_Engine/Python/src/python_toolkit/bhom_tkinter/widgets/widget_calendar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class CalendarWidget(BHoMBaseWidget):
1616
def __init__(
1717
self,
1818
parent: ttk.Frame,
19-
def_year: int,
20-
def_month: int,
21-
def_day: int,
19+
def_year: int = 2026,
20+
def_month: int = 1,
21+
def_day: int = 1,
2222
show_year_selector: bool = True,
2323
year_min: int = 1900,
2424
year_max: int = 2100,
@@ -218,7 +218,7 @@ def pack(self, **kwargs):
218218
def_year=2024,
219219
def_month=6,
220220
def_day=15,
221-
day_button_width=3,
221+
day_button_width=2,
222222
day_button_padx=2,
223223
day_button_pady=2,
224224
day_button_text_alignment="center",

0 commit comments

Comments
 (0)