我是新來的蟒蛇,閒逛,我注意到了這一點:爲什麼沒有返回而不是tkinter.Entry對象
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有None
而不是<tkinter.Entry object at ...
?
我正在使用python 3.2和PyScripter。
謝謝,我認爲它會返回與該位置的條目,但你的答案很有意義。 – 182764125216