[Tkinter-discuss] 回复: 回复: why tkinter do not quit?
守株待兔
1248283536 at qq.com
Wed Aug 10 05:14:57 CEST 2011
i am sitll confused,please see the following
>>> def abc():
... print "i am abc"
... return "i am not abc"
...
>>> abc
<function abc at 0xb780d17c>
>>> abc()
i am abc
'i am not abc'
>>>
code1
import Tkinter
def abc():
print "i am abc"
return "i am not abc"
top=Tkinter.Tk()
button=Tkinter.Button(top,text = 'Hello Button',command =abc)
button.pack()
top.mainloop()
when you click button ,the output is :
i am abc
my question is :where is the "i am not abc"??
code2
import Tkinter
def abc():
print "i am abc"
return "i am not abc"
top=Tkinter.Tk()
button=Tkinter.Button(top,text = 'Hello Button',command =abc())
button.pack()
top.mainloop()
when code2 run ,there is output "i am abc",(where is "i am not abc")?
when you click button ,there is no reaction, why?
------------------ 原始邮件 ------------------
发件人: "Igor Novikov"<igor.e.novikov at gmail.com>;
发送时间: 2011年8月9日(星期二) 晚上10:20
收件人: "守株待兔"<1248283536 at qq.com>;
抄送: "Tkinter-discuss"<Tkinter-discuss at python.org>;
主题: Re: 回复: [Tkinter-discuss] why tkinter do not quit?
2011/8/9 守株待兔 <1248283536 at qq.com>
what is the difference between quit and quit() ??
quit is a reference to callable but quit() is a method call.
The code command = top.quit just passes a callable reference,
but command = top.quit() passes result of top.quit() execution.
Possibly exception could be raised in last case.
--
Regards,
Igor Novikov
sK1 Project
http://sk1project.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20110810/7624c1ca/attachment-0001.html>
More information about the Tkinter-discuss
mailing list