TypeError:“标签”对象不可调用

时间:2019-05-24 19:13:53

标签: python data-binding typeerror

我正在创建一个简单的Python GUI,该GUI使用标签将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)

在回溯读取中没有行号显示为文件中的一行。这些函数没有任何参数,它们的作用是继续到下一行。

0 个答案:

没有答案