请问一下,python的tkinter的Button的回掉函数为什么按键

qq_41706609 2018-10-16 09:35:43
请问一下,python的tkinter的Button的回掉函数为什么按键被disabled了还会调用回掉函数啊。。。。。

代码如下

import tkinter

def ima():
print("我先执行")

# 实例化tkinter对象
print("我第二个执行")
top = tkinter.Tk()
top.geometry('220x60') # 设置窗口大小
top.title('tkinter使用举例') # 设置窗口标
print("我要被调用了")
quit_btn = tkinter.Button(top, text='quit', state='disabled',command=ima(),bg='red', fg='white')
# 设置按钮填充所有横向空间
quit_btn.pack(fill=tkinter.X, expand=1)

# 循环运行
tkinter.mainloop()
...全文
130 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

37,720

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧