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.novi...@gmail.com>;
发送时间: 2011年8月9日(星期二) 晚上10:20
收件人: "守株待兔"<1248283...@qq.com>; 
抄送: "Tkinter-discuss"<Tkinter-discuss@python.org>; 
主题: Re: 回复: [Tkinter-discuss] why tkinter do not quit?

 
 

2011/8/9 守株待兔 <1248283...@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
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to