I have the following code to build a listbox with Treeview widget.
import tkinter as tk
import tkinter.ttk as ttk
class AppBase:
def __init__(self):
self.mywin = tk.Tk()
self.mywin.geometry("%dx%d+%d+%d" % (800, 600, 5, 5))
self.frame1 = tk.Frame(self.mywin)
self.frame1.pack()
lb_header = ['name', 'surname']
lb_list = [
('John', 'Smith') ,
('Larry', 'Black') ,
('Walter', 'White') ,
('Fred', 'Becker')
]
self.tree = ttk.Treeview(columns=lb_header, show="headings")
self.tree.grid(in_=self.frame1)
for col in lb_header:
self.tree.heading(col, text=col.title())
for item in lb_list:
self.tree.insert('', 'end', values=item)
def start(self):
self.mywin.mainloop()
app=AppBase()
app.start()
It works but if there are few lines I have some empty lines at the end.

If I increase the number of data lines I have less empty lines, I think there is a minimum number of lines and if the data lines are less than minimum the listbox shows white lines.
How can I fix that and set the listbox to have not minimun lines?