182*_*216 5 python tkinter python-3.2
我是 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()
Run Code Online (Sandbox Code Playgroud)
输出包括:
'txtTest1': None
'txtTest2': <tkinter.Entry object at 0x00EADD70>
为什么 test1 有一个None而不是<tkinter.Entry object at ...?
我正在使用 python 3.2 和 PyScripter。
| 归档时间: |
|
| 查看次数: |
2158 次 |
| 最近记录: |