Python - AttributeError: 'str' object has no attribute 'items' Python - AttributeError: 'str' object has no attribute 'items' tkinter tkinter

Python - AttributeError: 'str' object has no attribute 'items'


You need to say tkinter, what are those "One", "Two" etc.. for.

Button(f, text="One")Label(wn, text="This is my label!")

To answer why you need that, you should check how functions and arguments work in python.

Also, you might want to pack your Frame since all your buttons on it and you can use "left" instead of tkinter.LEFT


did you mean this?

from tkinter import Tkfrom tkinter import Buttonfrom tkinter import LEFTfrom tkinter import Labelfrom tkinter import Framefrom tkinter import Packwn = Tk()f = Frame(wn)b1 = Button(f, text="One")# see that i added the text=# you need the text="text" instead of just placing the text string # Tkinter doesn't know what the "One","Two",... is for.b2 = Button(f, text="Two")b3 = Button(f, text="Three")b1.pack(side=LEFT)b2.pack(side=LEFT)b3.pack(side=LEFT)l = Label(wn, "This is my label!")l.pack()l.pack()wn.mainloop()