diff --git a/customtkinter/windows/ctk_tk.py b/customtkinter/windows/ctk_tk.py index cc3c9407..21037b64 100644 --- a/customtkinter/windows/ctk_tk.py +++ b/customtkinter/windows/ctk_tk.py @@ -163,6 +163,10 @@ def mainloop(self, *args, **kwargs): super().mainloop(*args, **kwargs) def resizable(self, width: bool = None, height: bool = None): + ''' + Configures whether the window is resizable + by the user in the x or y direction + ''' current_resizable_values = super().resizable(width, height) self._last_resizable_args = ([], {"width": width, "height": height}) @@ -172,6 +176,7 @@ def resizable(self, width: bool = None, height: bool = None): return current_resizable_values def minsize(self, width: int = None, height: int = None): + ''' Sets a minimum size of the window in pixels''' self._min_width = width self._min_height = height if self._current_width < width: @@ -181,6 +186,7 @@ def minsize(self, width: int = None, height: int = None): super().minsize(self._apply_window_scaling(self._min_width), self._apply_window_scaling(self._min_height)) def maxsize(self, width: int = None, height: int = None): + ''' Sets a maximum size of the window in pixels ''' self._max_width = width self._max_height = height if self._current_width > width: @@ -190,6 +196,7 @@ def maxsize(self, width: int = None, height: int = None): super().maxsize(self._apply_window_scaling(self._max_width), self._apply_window_scaling(self._max_height)) def geometry(self, geometry_string: str = None): + ''' This sets the size of a window in pixels, given as str in form "WIDTHxHEIGHT" ''' if geometry_string is not None: super().geometry(self._apply_geometry_scaling(geometry_string)) diff --git a/customtkinter/windows/widgets/ctk_scrollable_frame.py b/customtkinter/windows/widgets/ctk_scrollable_frame.py index 685deb2f..20b3a68e 100644 --- a/customtkinter/windows/widgets/ctk_scrollable_frame.py +++ b/customtkinter/windows/widgets/ctk_scrollable_frame.py @@ -74,7 +74,13 @@ def __init__(self, self.bind("", lambda e: self._parent_canvas.configure(scrollregion=self._parent_canvas.bbox("all"))) self._parent_canvas.bind("", self._fit_frame_dimensions_to_canvas) - self.bind_all("", self._mouse_wheel_all, add="+") + + if "linux" in sys.platform: + self.bind_all("", self._mouse_wheel_all, add="+") + self.bind_all("", self._mouse_wheel_all, add="+") + else: + self.bind_all("", self._mouse_wheel_all, add="+") + self.bind_all("", self._keyboard_shift_press_all, add="+") self.bind_all("", self._keyboard_shift_press_all, add="+") self.bind_all("", self._keyboard_shift_release_all, add="+") @@ -243,6 +249,8 @@ def _set_scroll_increments(self): self._parent_canvas.configure(xscrollincrement=1, yscrollincrement=1) elif sys.platform == "darwin": self._parent_canvas.configure(xscrollincrement=4, yscrollincrement=8) + else: + self._parent_canvas.configure(xscrollincrement=30, yscrollincrement=30) def _mouse_wheel_all(self, event): if self.check_if_master_is_canvas(event.widget): @@ -263,10 +271,11 @@ def _mouse_wheel_all(self, event): else: if self._shift_pressed: if self._parent_canvas.xview() != (0.0, 1.0): - self._parent_canvas.xview("scroll", -event.delta, "units") + self._parent_canvas.xview_scroll(-1 if event.num == 4 else 1, "units") else: if self._parent_canvas.yview() != (0.0, 1.0): - self._parent_canvas.yview("scroll", -event.delta, "units") + self._parent_canvas.yview_scroll(-1 if event.num == 4 else 1, "units") + def _keyboard_shift_press_all(self, event): self._shift_pressed = True diff --git a/test/manual_integration_tests/test_scrollable_frame.py b/test/manual_integration_tests/test_scrollable_frame.py index c7c0127a..a5a377ad 100644 --- a/test/manual_integration_tests/test_scrollable_frame.py +++ b/test/manual_integration_tests/test_scrollable_frame.py @@ -26,7 +26,7 @@ frame_5 = customtkinter.CTkScrollableFrame(app, orientation="vertical", label_text="CTkScrollableFrame", corner_radius=0) frame_5.grid(row=0, column=2, rowspan=2, sticky="nsew") -for i in range(100): +for i in range(20): customtkinter.CTkCheckBox(frame_1).grid(row=i, padx=10, pady=10) customtkinter.CTkCheckBox(frame_2).grid(row=i, padx=10, pady=10) customtkinter.CTkCheckBox(frame_3).grid(row=0, column=i, padx=10, pady=10)