TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
11.63k stars 1.09k forks source link

Scrollable frame , scrollbar is hiding right border #2542

Open Mirjax2000 opened 3 months ago

Mirjax2000 commented 3 months ago

image

dipeshSam commented 3 months ago

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.

Mirjax2000 commented 3 months ago

thank you wizard

dipeshSam commented 3 months ago

You are most welcome.

Regards.