@@ -1300,25 +1300,32 @@ def __init__(self, settings: ScanSettings, initial_videos: ty.List[str]):
13001300 self ._root .columnconfigure (0 , weight = 1 )
13011301 self ._root .rowconfigure (0 , weight = 1 )
13021302
1303- # Create a canvas and a scrollbar.
1304- canvas = tk .Canvas (self ._root )
1305- scrollbar = ttk .Scrollbar (self ._root , orient = "vertical" , command = canvas .yview )
1303+ # Create a canvas and scrollbars.
1304+ canvas = tk .Canvas (self ._root , borderwidth = 0 , highlightthickness = 0 )
1305+ v_scrollbar = ttk .Scrollbar (self ._root , orient = "vertical" , command = canvas .yview )
1306+ h_scrollbar = ttk .Scrollbar (self ._root , orient = "horizontal" , command = canvas .xview )
13061307 scrollable_frame = ttk .Frame (canvas )
13071308
13081309 scrollable_frame .bind (
13091310 "<Configure>" , lambda e : canvas .configure (scrollregion = canvas .bbox ("all" ))
13101311 )
13111312
1312- canvas .create_window ((0 , 0 ), window = scrollable_frame , anchor = "nw" )
1313- canvas .configure (yscrollcommand = scrollbar .set )
1313+ scrollable_window = canvas .create_window ((0 , 0 ), window = scrollable_frame , anchor = "nw" )
1314+ canvas .configure (yscrollcommand = v_scrollbar .set , xscrollcommand = h_scrollbar .set )
1315+
1316+ def _configure_canvas (event ):
1317+ canvas .itemconfig (scrollable_window , width = event .width )
1318+
1319+ canvas .bind ("<Configure>" , _configure_canvas )
13141320
13151321 def _on_mousewheel (event ):
13161322 canvas .yview_scroll (int (- 1 * (event .delta / 120 )), "units" )
13171323
13181324 canvas .bind_all ("<MouseWheel>" , _on_mousewheel )
13191325
1320- canvas .grid (row = 0 , column = 0 , sticky = "nsew" )
1321- scrollbar .grid (row = 0 , column = 1 , sticky = "ns" )
1326+ v_scrollbar .pack (side = "right" , fill = "y" )
1327+ h_scrollbar .pack (side = "bottom" , fill = "x" )
1328+ canvas .pack (side = "left" , fill = "both" , expand = True )
13221329
13231330 scrollable_frame .columnconfigure (0 , weight = 1 )
13241331
@@ -1334,6 +1341,7 @@ def _on_mousewheel(event):
13341341 output_frame .grid (row = 2 , sticky = EXPAND_HORIZONTAL , padx = PADDING , pady = (PADDING , 0 ))
13351342
13361343 scan_frame = CollapsibleFrame (scrollable_frame , text = "Run" )
1344+ # TODO: Avoid passing self._root to child widgets.
13371345 self ._scan_area = ScanArea (self ._root , scan_frame .content_frame )
13381346 scan_frame .grid (row = 3 , sticky = EXPAND_HORIZONTAL , padx = PADDING , pady = PADDING )
13391347
0 commit comments