_tkinter.TclError: unknown option "-class"

Traceback (most recent call last):
  File "calculator.py", line 41, in <module>
    b_del = Button(f_row1, root, image=bdel)
  File "C:\Users\asus\AppData\Local\Programs\Python\Python37-32\lib\tkinter\__init__.py", line 2369, in __init__
    Widget.__init__(self, master, 'button', cnf, kw)
  File "C:\Users\asus\AppData\Local\Programs\Python\Python37-32\lib\tkinter\__init__.py", line 2299, in __init__
    (widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: unknown option "-class"

Вылазит такая ошибка, я новичок в tkinter и не знаю что делать((. Помогите, пожалуйста!

Вот код:

from tkinter import *

root = Tk()
root.geometry("400x500")
root.resizable(False, False)

# images
bdel = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\bdel.png', height=70, width=100)
bdot = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\bdot.png', height=70, width=100)
bcl = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\bcl.png', height=70, width=100)
bresult = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\bresult.png', height=70, width=100)

b7 = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\b7.png', height=70, width=100)
b8 = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\b8.png', height=70, width=100)
b9 = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\b9.png', height=70, width=100)
bdivi = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\bdivi.png', height=70, width=100)

b4 = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\b4.png', height=70, width=100)
b5 = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\b5.png', height=70, width=100)
b6 = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\b6.png', height=70, width=100)
bx = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\bx.png', height=70, width=100)

b1 = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\b1.png', height=70, width=100)
b2 = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\b2.png', height=70, width=100)
b3 = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\b3.png', height=70, width=100)
bminus = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\bminus.png', height=70, width=100)

bsqr = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\bsqr.png', height=70, width=100)
b0 = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\b0.png', height=70, width=100)
bsqrt = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\bsqrt.png', height=70, width=100)
bplus = PhotoImage(file = r'C:\Users\asus\Pictures\tkiners images\bplus.png', height=70, width=100)


# widgets
f_row1 = Frame()
f_row2 = Frame()
f_row3 = Frame()
f_row4 = Frame()
f_row5 = Frame()

b_del = Button(f_row1, root, image=bdel) # line 41 ------------------------------------------------------
b_dot = Button(f_row1, root, image=bdot)
b_cl = Button(f_row1, root, image=bcl)
b_result = Button(f_row1, root, image=bresult)

b_7 = Button(f_row2, root, image=b7)
b_8 = Button(f_row2, root, image=b8)
b_9 = Button(f_row2, root, image=b9)
b_divi = Button(f_row2, root, image=bdivi)

b_4 = Button(f_row3, root, image=b4)
b_5 = Button(f_row3, root, image=b5)
b_6 = Button(f_row3, root, image=b6)
b_x = Button(f_row3, root, image=bx)

b_1 = Button(f_row4, root, image=b1)
b_2 = Button(f_row4, root, image=b2)
b_3 = Button(f_row4, root, image=b3)
b_minus = Button(f_row4, root, image=bminus)

b_sqr = Button(f_row5, root, image=bsqr)
b_0 = Button(f_row5, root, image=b0)
b_sqrt = Button(f_row5, root, image=bsqrt)
b_plus = Button(f_row5, root, image=bplus)

lbl = Label(root, bg='cyan', fg='black', width=20)

# rows pack
f_row1.pack()
f_row2.pack()
f_row3.pack()
f_row4.pack()
f_row5.pack()

# buttons pack
b_del.pack(side=LEFT)
b_dot.pack(side=LEFT)
b_cl.pack(side=LEFT)
b_result.pack(side=LEFT)

b_7.pack(side=LEFT)
b_8.pack(side=LEFT)
b_9.pack(side=LEFT)
b_divi.pack(side=LEFT)

b_4.pack(side=LEFT)
b_5.pack(side=LEFT)
b_6.pack(side=LEFT)
b_x.pack(side=LEFT)

b_1.pack(side=LEFT)
b_2.pack(side=LEFT)
b_3.pack(side=LEFT)
b_minus.pack(side=LEFT)

b_sqr.pack(side=LEFT)
b_0.pack(side=LEFT)
b_sqrt.pack(side=LEFT)
b_plus.pack(side=LEFT)

 #label pack


# === RUN ===
root.mainloop()

Ответы (1 шт):

Автор решения: gil9red

Укажите только одного master.

Пример:

b_del = Button(f_row1, image=bdel)
→ Ссылка