TypeError: object of type: 'Frame' has no len() TypeError: object of type: 'Frame' has no len() tkinter tkinter

TypeError: object of type: 'Frame' has no len()


You aren't calling pack correctly - see here for documentation. The error is thrown because the pack function does not take a widget as a positional argument.

It seems that you are under the incorrect impression that it is the pack function's job to specify which widget is the child of which widget. In fact, when you create a widget, you must tell the widget what its parent is. Here's how to fix it:

When you create the widgets, the first argument should be the widget's intended parent widget:

opt1=tk.Button(options1)opt2=tk.Button(options1)opt3=tk.Button(options2)opt4=tk.Button(options2)

Then later, when you pack them, they already know what widget they belong to:

opt1.pack()opt2.pack()opt3.pack()opt4.pack()

Then in case you forgot, you need to begin the GUI's main loop:

window.mainloop()