我是 python 新手,四处逛逛,我注意到了这一点:
from tkinter import *
def test1():
root = Tk()
txtTest1 = Entry(root).place(x=10, y=10)
print(locals())
def test2():
root = Tk()
txtTest2 = Entry(root)
txtTest2.place(x=10, y=10)#difference is this line
print(locals())
test1()
test2()
输出包含:
'txtTest1': None
'txtTest2': <tkinter.Entry object at 0x00EADD70>
为什么 test1 有 aNone
而不是<tkinter.Entry object at ...
?
我正在使用 python 3.2 和 PyScripter。