I am using the ttk Treeview widget to implement a folder / path select dialog. Everything works as expected, except that my horizontal scrollbar is not activated. No matter how wide the path to the folder goes horizontally, and no matter how narrow the window is, a horizontal slider never appears. Vertical scrolling works fine, though.
I see this as some kind of limitation when you use only one column in the tree structure or just a newbie mistake with setting up and connecting widgets. I would argue on the latter.
An example with a dialog extension showing the full depth of a folder:

The dialog is narrowed down to the point where horizontal scrolling should be activated (but not):

Here is my GUI layout code:
winDirSel = tk.Toplevel() winDirSel.title('Select Test Directory...') tvwDirSel = ttk.Treeview(winDirSel, height=10,padding=3, show='tree') lblTestDir = tk.Label(winDirSel, relief=tk.SUNKEN, justify=tk.LEFT, anchor=tk.W, textvariable=ctrlTestDir,width=80) scbHDirSel = ttk.Scrollbar(winDirSel, orient=tk.HORIZONTAL, command=tvwDirSel.xview) scbVDirSel = ttk.Scrollbar(winDirSel, orient=tk.VERTICAL, command=tvwDirSel.yview) tvwDirSel.configure(xscrollcommand=scbHDirSel.set, yscrollcommand=scbVDirSel.set) lblTestDir.grid(row=0,column=0,sticky=tk.EW) tvwDirSel.grid(row=1,column=0,sticky=tk.NSEW) scbVDirSel.grid(row=1,column=1,sticky=tk.NS) scbHDirSel.grid(row=2,column=0,sticky=tk.EW) winDirSel.rowconfigure(1,weight=1) winDirSel.columnconfigure(0,weight=1)
Jdm
source share