@@ -43,6 +43,7 @@ def __init__(self,
4343 # dimensions independent of scaling
4444 self ._desired_width = width # _desired_width and _desired_height, represent desired size set by width and height
4545 self ._desired_height = height
46+ self ._border_width = border_width if border_width else 0
4647
4748 self ._parent_frame = CTkFrame (master = master , width = 0 , height = 0 , corner_radius = corner_radius ,
4849 border_width = border_width , bg_color = bg_color , fg_color = fg_color , border_color = border_color )
@@ -99,21 +100,23 @@ def _create_grid(self):
99100 border_spacing = self ._apply_widget_scaling (self ._parent_frame .cget ("corner_radius" ) + self ._parent_frame .cget ("border_width" ))
100101
101102 if self ._orientation == "horizontal" :
103+ border_padding = (0 , self ._border_width + 1 )
102104 self ._parent_frame .grid_columnconfigure (0 , weight = 1 )
103105 self ._parent_frame .grid_rowconfigure (1 , weight = 1 )
104106 self ._parent_canvas .grid (row = 1 , column = 0 , sticky = "nsew" , padx = border_spacing , pady = (border_spacing , 0 ))
105- self ._scrollbar .grid (row = 2 , column = 0 , sticky = "nsew" , padx = border_spacing )
107+ self ._scrollbar .grid (row = 2 , column = 0 , sticky = "nsew" , padx = border_spacing , pady = border_padding )
106108
107109 if self ._label_text is not None and self ._label_text != "" :
108110 self ._label .grid (row = 0 , column = 0 , sticky = "ew" , padx = border_spacing , pady = border_spacing )
109111 else :
110112 self ._label .grid_forget ()
111113
112114 elif self ._orientation == "vertical" :
115+ border_padding = (0 , self ._border_width + 1 )
113116 self ._parent_frame .grid_columnconfigure (0 , weight = 1 )
114117 self ._parent_frame .grid_rowconfigure (1 , weight = 1 )
115118 self ._parent_canvas .grid (row = 1 , column = 0 , sticky = "nsew" , padx = (border_spacing , 0 ), pady = border_spacing )
116- self ._scrollbar .grid (row = 1 , column = 1 , sticky = "nsew" , pady = border_spacing )
119+ self ._scrollbar .grid (row = 1 , column = 1 , sticky = "nsew" , padx = border_padding , pady = border_spacing )
117120
118121 if self ._label_text is not None and self ._label_text != "" :
119122 self ._label .grid (row = 0 , column = 0 , columnspan = 2 , sticky = "ew" , padx = border_spacing , pady = border_spacing )
@@ -160,7 +163,8 @@ def configure(self, **kwargs):
160163 self ._create_grid ()
161164
162165 if "border_width" in kwargs :
163- self ._parent_frame .configure (border_width = kwargs .pop ("border_width" ))
166+ self ._border_width = kwargs .pop ("border_width" )
167+ self ._parent_frame .configure (border_width = self ._border_width )
164168 self ._create_grid ()
165169
166170 if "fg_color" in kwargs :
0 commit comments