Skip to content Skip to sidebar Skip to footer

Tkinter Listbox Error - Attributeerror: 'int' Object Has No Attribute 'tk'

I am new to tkinter and trying to make a listbox. This is the code I am using, I keep getting the error AttributeError: 'int' object has no attribute 'tk'. What am I doing wrong? f

Solution 1:

You need to call method from instance of a widget. Right now you are trying to use Type as instance.

for widget in WidgetNames:
    myList.insert(0, widget) 

Also, not sure which IDE you are using but even if some IDEs calls mainloop implicitly, it would be better to add it explicitly.

def ListWindow():
    Listwindow = Tk() 
    ....
    ....
    myList.grid(row=0,column=0,columnspan=10)
    Listwindow.mainloop()

Post a Comment for "Tkinter Listbox Error - Attributeerror: 'int' Object Has No Attribute 'tk'"