CustomTkinter icon indicating copy to clipboard operation
CustomTkinter copied to clipboard

Scrollable frame , scrollbar is hiding right border

Open Mirjax2000 opened this issue 1 year ago • 3 comments

image

Mirjax2000 avatar Aug 18 '24 10:08 Mirjax2000

This is a valid problem. Before any new update, you may try the following solution:

Before Scene: Scrollbar_Before

Code example:

from customtkinter import CTkScrollbar
from customtkinter import CTk, CTkScrollableFrame

def padding_in_scrollable(s_frame: CTkScrollableFrame):
    """Adds padding to scrollbar of a scrollable frame."""
    
    if scrollbar:=getattr(s_frame, "_scrollbar", None):
        padding = s_frame.cget("border_width") * 2
        CTkScrollbar.grid_configure(scrollbar, padx=padding)   
                 


if __name__ == "__main__":
    app = CTk()
    app.geometry("900x600")

    s_frame = CTkScrollableFrame(app,
                                 width=400,
                                 height=300, 
                                 border_width=2,                                
                                 fg_color="gray25",
                                 border_color="lightblue")
    
    s_frame.place(relx=0.5, anchor="center", rely=0.5)

    
    padding_in_scrollable(s_frame)
    

    app.mainloop()

Output: Scrollbar_After

Hope, it will be helpful. Regards.

dipeshSam avatar Aug 18 '24 12:08 dipeshSam

thank you wizard

Mirjax2000 avatar Aug 18 '24 13:08 Mirjax2000

You are most welcome.

Regards.

dipeshSam avatar Aug 18 '24 17:08 dipeshSam