diff --git a/customtkinter/draw_engine.py b/customtkinter/draw_engine.py index a117ccf..51148ee 100644 --- a/customtkinter/draw_engine.py +++ b/customtkinter/draw_engine.py @@ -1074,14 +1074,14 @@ class DrawEngine: elif self._canvas.find_withtag("scrollbar_rectangle_2") and not width > 2 * corner_radius: self._canvas.delete("scrollbar_rectangle_2") - self._canvas.coords("scrollbar_rectangle_1", - corner_radius - inner_corner_radius, corner_radius + (height - 2 * corner_radius) * start_value, - width - (corner_radius - inner_corner_radius), corner_radius + (height - 2 * corner_radius) * end_value) - self._canvas.coords("scrollbar_rectangle_2", - corner_radius, corner_radius - inner_corner_radius + (height - 2 * corner_radius) * start_value, - width - (corner_radius), corner_radius + inner_corner_radius + (height - 2 * corner_radius) * end_value) - if orientation == "vertical": + self._canvas.coords("scrollbar_rectangle_1", + corner_radius - inner_corner_radius, corner_radius + (height - 2 * corner_radius) * start_value, + width - (corner_radius - inner_corner_radius), corner_radius + (height - 2 * corner_radius) * end_value) + self._canvas.coords("scrollbar_rectangle_2", + corner_radius, corner_radius - inner_corner_radius + (height - 2 * corner_radius) * start_value, + width - (corner_radius), corner_radius + inner_corner_radius + (height - 2 * corner_radius) * end_value) + self._canvas.coords("scrollbar_oval_1_a", corner_radius, corner_radius + (height - 2 * corner_radius) * start_value, inner_corner_radius) self._canvas.coords("scrollbar_oval_1_b", corner_radius, corner_radius + (height - 2 * corner_radius) * start_value, inner_corner_radius) self._canvas.coords("scrollbar_oval_2_a", width - corner_radius, corner_radius + (height - 2 * corner_radius) * start_value, inner_corner_radius) @@ -1090,7 +1090,15 @@ class DrawEngine: self._canvas.coords("scrollbar_oval_3_b", width - corner_radius, corner_radius + (height - 2 * corner_radius) * end_value, inner_corner_radius) self._canvas.coords("scrollbar_oval_4_a", corner_radius, corner_radius + (height - 2 * corner_radius) * end_value, inner_corner_radius) self._canvas.coords("scrollbar_oval_4_b", corner_radius, corner_radius + (height - 2 * corner_radius) * end_value, inner_corner_radius) + if orientation == "horizontal": + self._canvas.coords("scrollbar_rectangle_1", + corner_radius - inner_corner_radius + (width - 2 * corner_radius) * start_value, corner_radius, + corner_radius + inner_corner_radius + (width - 2 * corner_radius) * end_value, height - corner_radius) + self._canvas.coords("scrollbar_rectangle_2", + corner_radius + (width - 2 * corner_radius) * start_value, corner_radius - inner_corner_radius, + corner_radius + (width - 2 * corner_radius) * end_value, height - (corner_radius - inner_corner_radius)) + self._canvas.coords("scrollbar_oval_1_a", corner_radius + (width - 2 * corner_radius) * start_value, corner_radius, inner_corner_radius) self._canvas.coords("scrollbar_oval_1_b", corner_radius + (width - 2 * corner_radius) * start_value, corner_radius, inner_corner_radius) self._canvas.coords("scrollbar_oval_2_a", corner_radius + (width - 2 * corner_radius) * end_value, corner_radius, inner_corner_radius) diff --git a/test/manual_integration_tests/test_scrollbar.py b/test/manual_integration_tests/test_scrollbar.py index 5fcced0..d579911 100644 --- a/test/manual_integration_tests/test_scrollbar.py +++ b/test/manual_integration_tests/test_scrollbar.py @@ -33,7 +33,7 @@ ctk_textbox_scrollbar_1.configure(scrollbar_color="red", scrollbar_hover_color=" frame_2 = customtkinter.CTkFrame(frame_1) frame_2.grid(row=1, column=0, columnspan=2, padx=20, pady=20, sticky="nsew") -frame_2.grid_rowconfigure((0, 1), weight=1) +frame_2.grid_rowconfigure((0, ), weight=1) frame_2.grid_columnconfigure((0, ), weight=1) tk_textbox_2 = tkinter.Text(frame_2, highlightthickness=0, padx=5, pady=5, wrap="none") tk_textbox_2.grid(row=0, column=0, sticky="nsew", padx=(5, 0), pady=5)