Skip to content

Comments

Added feature (orientation= 'both') and fixed padding issues#2791

Open
Trucee wants to merge 1 commit intoTomSchimansky:masterfrom
Trucee:add-feature
Open

Added feature (orientation= 'both') and fixed padding issues#2791
Trucee wants to merge 1 commit intoTomSchimansky:masterfrom
Trucee:add-feature

Conversation

@Trucee
Copy link

@Trucee Trucee commented Feb 17, 2026

✨ Added Feature: orientation="both"

Summary

Added support for orientation="both" to allow simultaneous horizontal and vertical scrolling.

Previously, widgets only supported:

  • "vertical"
  • "horizontal"

Now users can use:

orientation="both"

to enable scrolling in both directions.


Example Usage

scrollable_frame = customtkinter.CTkScrollableFrame(
    master=app,
    orientation="both"
)
scrollable_frame.pack()

This allows content larger than the container to scroll both vertically and horizontally.
feature1


Behavior

  • "vertical" → vertical scrollbar only
  • "horizontal" → horizontal scrollbar only
  • "both" → both scrollbars appear when needed

Backward compatibility is preserved.
Existing code using "vertical" or "horizontal" works unchanged.


🛠 Fix: Border_width

Issue

when user increase Border_width empty space between label and canvas increase automatically.

Before

before1

After

pro2

Combine:

pro1

✅ Why This Improvement Is Useful

  • Enables more flexible scrollable layouts
  • Fixes inconsistency in border_width
  • Maintains full backward compatibility

Test script

import customtkinter as ctk

root = ctk.CTk()
root.geometry("1400x550")
root.title('Scroll Frame test')

vertical_sfrm = ctk.CTkScrollableFrame(root, orientation="vertical", label_text='Vertical', border_width=100, border_color='orange',
                                       scrollbar_fg_color='green',
                                       scrollbar_button_color='yellow',
                                       scrollbar_button_hover_color='blue')
vertical_sfrm.pack(side='left', padx=(20, 0))

horizontal_sfrm = ctk.CTkScrollableFrame(root, orientation="horizontal", label_text='Horizontal', border_width=100, border_color='orange', scrollbar_fg_color='green')
horizontal_sfrm.pack(side='left', padx=(20, 0))

both_sfrm = ctk.CTkScrollableFrame(root, orientation="both", label_text='Both Side', border_width=100, border_color='orange', scrollbar_fg_color='green')
both_sfrm.pack(side='left', padx=(20, 0))

grid = 10
for row in range(grid):
    row_frm = ctk.CTkFrame(vertical_sfrm)
    row_frm.pack()
    for col in range(grid):
        label = ctk.CTkLabel(row_frm, text=f"label no: {row}x{col}.")
        label.pack(side='left')


for row in range(grid):
    row_frm = ctk.CTkFrame(horizontal_sfrm)
    row_frm.pack()
    for col in range(grid):
        label = ctk.CTkLabel(row_frm, text=f"label no: {row}x{col}.")
        label.pack(side='left')


for row in range(grid):
    row_frm = ctk.CTkFrame(both_sfrm)
    row_frm.pack()
    for col in range(grid):
        label = ctk.CTkLabel(row_frm, text=f"label no: {row}x{col}.")
        label.pack(side='left')

root.mainloop()

@Trucee Trucee closed this Feb 17, 2026
@Trucee Trucee reopened this Feb 17, 2026
@dipeshSam
Copy link
Contributor

@Trucee
Great work! Keep it up.

@FedericoSpada
Copy link
Collaborator

Hi,
I saw your PR, and it is very similar to #2361. Moreover, I've spent a little time implementing the same thing myself, but ultimately, I've decided to postpone it because it was quite impactful.

At the moment, I'm waiting myself for the original owner of the repository to merge all changes I've made from the Develop branch to the main one. I intend to add the proposed feature in one way or another, but I can't promise when it will happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants