I'm trying to get my Treeview to fit within the right-side frame, but I'm not sure where in my code is causing the frame to fall outside the window. The Treeview has 20+ columns and both horizontal/vertical scrollbars assigned to the frame. I also noticed that when I populate the Treeview with rows, I'm able to scroll up and down but I can't use the horizontal scrollbar, could this have something to do with it?
Thank you all.
from tkinter import *
from tkinter import filedialog
from tkinter import ttk
import os
root = Tk()
root.geometry("800x600")
root.resizable(False,False)
commandFrame = Frame(root) # Define frame for commands
commandFrame.grid(row=0,column=0,pady=20,padx=(10,0),sticky=N) # Place frame on left side
dirButton = Button(commandFrame, text="Select Database", width=20, pady=5, bd=3)
dirButton.grid(row=0,column=0,pady=(0,3))
saveButton = Button(commandFrame, text="Save Results", state=DISABLED, width=20, pady=5, bd=3)
saveButton.grid(row=1,column=0,pady=(0,3))
resetButton = Button(commandFrame, text="Reset", state=DISABLED, width=20, pady=5, bd=3)
resetButton.grid(row=2,column=0,pady=(0,3))
helpButton = Button(commandFrame, text="Help", width=20, pady=5, bd=3)
helpButton.grid(row=3,column=0,pady=(0,3))
dbButton = Button(commandFrame, text="Create Database", width=20, pady=5, bd=3)
dbButton.grid(row=4,column=0,pady=(0,3))
updateButton = Button(commandFrame, text="Update Database", state=DISABLED, width=20, pady=5, bd=3)
updateButton.grid(row=5,column=0,pady=(0,3))
tableFrame = Frame(root) # Define frame for query area
tableFrame.grid(row=0,column=1,pady=20,padx=10) # Place frame on right side
yscroll = Scrollbar(tableFrame, orient="vertical") # Define scroll bars for query area
xscroll = Scrollbar(tableFrame, orient="horizontal")
yscroll.pack(side=RIGHT, fill=Y) # Pack scroll bars for query area
xscroll.pack(side=BOTTOM, fill=X)
tableArea = ttk.Treeview(tableFrame, yscrollcommand=yscroll.set,
xscrollcommand=xscroll.set, height=10) # Define Treeview with scrollbars
yscroll.config(command=tableArea.yview) # Assign scrollbar to axes
xscroll.config(command=tableArea.xview)
tableArea.pack() # Put in frame
tableArea["columns"] = ("1","2","3","4","5","6","7","8","9","10","11","12",
"13","14","15","16","17")
# Format columns
tableArea.column("#0", width=0, stretch=NO)
tableArea.column("1", width=120, minwidth=25, anchor=W)
tableArea.column("2", width=120, minwidth=25, anchor=W)
tableArea.column("3", width=120, minwidth=25, anchor=W)
tableArea.column("4", width=120, minwidth=25, anchor=W)
tableArea.column("5", width=120, minwidth=25, anchor=W)
tableArea.column("6", width=120, minwidth=25, anchor=W)
tableArea.column("7", width=120, minwidth=25, anchor=W)
tableArea.column("8", width=120, minwidth=25, anchor=W)
tableArea.column("9", width=120, minwidth=25, anchor=W)
tableArea.column("10", width=120, minwidth=25, anchor=W)
tableArea.column("11", width=120, minwidth=25, anchor=W)
tableArea.column("12", width=120, minwidth=25, anchor=W)
tableArea.column("13", width=120, minwidth=25, anchor=W)
tableArea.column("14", width=120, minwidth=25, anchor=W)
tableArea.column("15", width=120, minwidth=25, anchor=W)
tableArea.column("16", width=120, minwidth=25, anchor=W)
tableArea.column("17", width=120, minwidth=25, anchor=W)
root.mainloop()