I am trying to generate an input table for my membrane sizing app. To avoid entering each Label individually (which does work but laborious) I wanted to generate them row by row using a loop. Unfortunately tkinter widget created inside the loop don’t seem to accept the same option formatting as the individual assignments.
# Setup
window = tk.Tk()
frm = ttk.Frame(window, padding=10)
frm.grid()
# Header Row
header_text = ['Stream #', 'Units', '0', '1', '1a', '1b', '2', '3', '4', '5', '6']
for i in range(len(header_text)):
column[i] = ttk.Label(frm, font = 'Calibri, 14, bold', text = header_text[i])
column[i].grid(row = 0, column = i, padx = 10, pady = 5, sticky = 's')
Error message received is
_tkinter.TclError: expected integer but got “14,”