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

 
 

2011/8/9 守株待兔 <[email protected]>
 

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
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to