Ошибка типа: объект «Метка» не вызывается - PullRequest
0 голосов
/ 24 мая 2019

Я создаю простой графический интерфейс Python, который использует метки для привязки изображения GIF к функции. Тем не менее, он возвращает ошибку TypeError: 'Label' object not callable

Код выглядит следующим образом:

from tkinter import *

tk = Tk()
mode = 'draw'
filename = PhotoImage(file = 'bin\\Images\\pencil.gif')
draw = Label(tk, image=filename, width=53, height=47)
draw.place(x = 60, y = 620)
draw.img = filename
draw.bind('<Double-Button-1>', draw)
filename = PhotoImage(file = 'bin\\Images\\select.gif')
select = Label(tk, image=filename, width=53, height=46)
select.place(x = 160, y = 620)
select.img = filename
select.bind('<Double-Button-1>', select)
filename = PhotoImage(file = 'bin\\Images\\select_all.gif')
select_all = Label(tk, image=filename, width=53, height=48)
select_all.place(x = 260, y = 620)
select_all.img = filename
select_all.bind('<Double-Button-1>', select_all)
filename = PhotoImage(file = 'bin\\Images\\delete.gif')
delete = Label(tk, image=filename, width=50, height=45)
delete.place(x = 360, y = 620)
delete.img = filename
delete.bind('<Double-Button-1>', delete)
filename = PhotoImage(file = 'bin\\Images\\instrument_choose.gif')
inst = Label(tk, image=filename, width=355, height=51)
inst.place(x = 700, y = 620)
inst.img = filename
inst.bind('<Double-Button-1>', draw)

В строке трассировки нет номера строки в виде строки из моего файла. Функции не имеют никаких параметров, и они до сих пор переходят к следующей строке.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...