5454
5555"""
5656
57- version = "6.1.5 "
57+ version = "6.1.6 "
5858
5959
6060
86866.1.3 1-Jun-2026 Another try at fixing the upgrade from github bug that shows wrong installed version number. This time for sure....
87876.1.4 2-Jun-2026 Display the Maint Release version number in the Home Window. Moved the install button
88886.1.5 2-Jun-2026 Added ability to specify timers using string "H:M:S" when calling Window.start_timer.
89+ 6.1.6 3-Jun-2026 Enhancement - support for horizontal scroll only for scrollable column element
8990"""
9091
9192
@@ -8061,7 +8062,7 @@ class TkScrollableFrame(tk.Frame):
80618062 A frame with one or two scrollbars. Used to make Columns with scrollbars
80628063 """
80638064
8064- def __init__(self, master, vertical_only, element, window, **kwargs):
8065+ def __init__(self, master, vertical_only, horizontal_only, element, window, **kwargs):
80658066 """
80668067 :param master: The parent widget
80678068 :type master: (tk.Widget)
@@ -8077,26 +8078,23 @@ def __init__(self, master, vertical_only, element, window, **kwargs):
80778078 element.Widget = self.canvas
80788079 # Okay, we're gonna make a list. Containing the y-min, x-min, y-max, and x-max of the frame
80798080 element.element_frame = self
8080- _make_ttk_scrollbar(element, 'v', window)
8081- # element.vsb = tk.Scrollbar(self, orient=tk.VERTICAL)
8082- element.vsb.pack(side='right', fill="y", expand="false")
8081+ if not horizontal_only:
8082+ _make_ttk_scrollbar(element, 'v', window)
8083+ element.vsb.pack(side='right', fill="y", expand="false")
8084+ self.canvas.config(yscrollcommand=element.vsb.set)
80838085
80848086 if not vertical_only:
80858087 _make_ttk_scrollbar(element, 'h', window)
8086- # self.hscrollbar = tk.Scrollbar(self, orient=tk.HORIZONTAL)
80878088 element.hsb.pack(side='bottom', fill="x", expand="false")
80888089 self.canvas.config(xscrollcommand=element.hsb.set)
8089- # self.canvas = tk.Canvas(self, )
8090- # else:
8091- # self.canvas = tk.Canvas(self)
80928090
8093- self.canvas.config(yscrollcommand=element.vsb.set)
80948091 self.canvas.pack(side="left", fill="both", expand=True)
8095- # element.vsb.config(command=self.canvas.yview)
8096- element.vsb.config(command=self.yview_override)
8092+
80978093 if not vertical_only:
8098- # element.hsb.config(command=self.canvas.xview)
80998094 element.hsb.config(command=self.xview_override)
8095+ if not horizontal_only:
8096+ element.vsb.config(command=self.yview_override)
8097+
81008098
81018099 # reset the view
81028100 self.canvas.xview_moveto(0)
@@ -8192,7 +8190,7 @@ class Column(Element):
81928190 """
81938191
81948192 def __init__(self, layout, background_color=None, size=(None, None), s=(None, None), size_subsample_width=1, size_subsample_height=2, pad=None, p=None, scrollable=False,
8195- vertical_scroll_only=False, right_click_menu=None, key=None, k=None, visible=True, justification=None, element_justification=None,
8193+ vertical_scroll_only=False, horizontal_scroll_only=False, right_click_menu=None, key=None, k=None, visible=True, justification=None, element_justification=None,
81968194 vertical_alignment=None, grab=None, expand_x=None, expand_y=None, metadata=None,
81978195 sbar_trough_color=None, sbar_background_color=None, sbar_arrow_color=None, sbar_width=None, sbar_arrow_width=None,
81988196 sbar_frame_color=None, sbar_relief=None):
@@ -8217,6 +8215,8 @@ def __init__(self, layout, background_color=None, size=(None, None), s=(None, No
82178215 :type scrollable: (bool)
82188216 :param vertical_scroll_only: if True then no horizontal scrollbar will be shown if a scrollable column
82198217 :type vertical_scroll_only: (bool)
8218+ :param horizontal_scroll_only: if True then no verticale scrollbar will be shown if a scrollable column
8219+ :type horizontal_scroll_only: (bool)
82208220 :param right_click_menu: A list of lists of Menu items to show when this element is right clicked. See user docs for exact format.
82218221 :type right_click_menu: List[List[ List[str] | str ]]
82228222 :param key: Value that uniquely identifies this element from all other elements. Used when Finding an element or in return values. Must be unique to the window
@@ -8267,6 +8267,7 @@ def __init__(self, layout, background_color=None, size=(None, None), s=(None, No
82678267 self.TKColFrame = None # type: tk.Frame
82688268 self.Scrollable = scrollable
82698269 self.VerticalScrollOnly = vertical_scroll_only
8270+ self.HorizontalScrollOnly = horizontal_scroll_only
82708271
82718272 self.RightClickMenu = right_click_menu
82728273 bg = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR
@@ -15829,12 +15830,17 @@ def _add_expansion(element, row_should_expand, row_fill_direction):
1582915830 element = element # type: Column
1583015831 # ----------------------- SCROLLABLE Column ----------------------
1583115832 if element.Scrollable:
15832- element.Widget = element.TKColFrame = TkScrollableFrame(tk_row_frame, element.VerticalScrollOnly, element, toplevel_form) # do not use yet! not working
15833+ element.Widget = element.TKColFrame = TkScrollableFrame(tk_row_frame, element.VerticalScrollOnly, element.HorizontalScrollOnly, element , toplevel_form) # do not use yet! not working
1583315834 PackFormIntoFrame(element, element.TKColFrame.TKFrame, toplevel_form)
1583415835 element.TKColFrame.TKFrame.update()
1583515836 if element.Size == (None, None): # if no size specified, use column width x column height/2
15836- element.TKColFrame.canvas.config(width=element.TKColFrame.TKFrame.winfo_reqwidth() // element.size_subsample_width,
15837- height=element.TKColFrame.TKFrame.winfo_reqheight() // element.size_subsample_height)
15837+ width = element.TKColFrame.TKFrame.winfo_reqwidth()
15838+ if element.HorizontalScrollOnly:
15839+ width = width // element.size_subsample_width
15840+ height = element.TKColFrame.TKFrame.winfo_reqheight()
15841+ if element.VerticalScrollOnly:
15842+ height = height // element.size_subsample_height
15843+ element.TKColFrame.canvas.config(width=width, height=height)
1583815844 else:
1583915845 element.TKColFrame.canvas.config(width=element.TKColFrame.TKFrame.winfo_reqwidth() // element.size_subsample_width,
1584015846 height=element.TKColFrame.TKFrame.winfo_reqheight() // element.size_subsample_height)
0 commit comments