The Tk documentation says (last section) that nested layouts can be achieved using tk.frame
.
The following small example is not working as expected, instead of:
import tkinter as tk
window = tk.Tk()
window.geometry('250x100')
# first level, window as parent
tk.Label(window, text='Choose file:').grid(row=0, column=0, sticky=tk.W)
tk.Button(window, text='Browse ...').grid(row=1, column=0, sticky=tk.W)
fr = tk.Frame(window).grid(row=2, column=0, sticky=tk.W)
# nested, frame as parent
tk.Entry(fr).grid(row=0, column=0, sticky=tk.W)
tk.Entry(fr).grid(row=0, column=1, sticky=tk.W)
tk.mainloop()
it produces:
The real UI is much more complex, so I really want to use nested grids instead of one grid with multiple columns.