Tkinter无法将标签附加到列表中?

时间:2013-03-02 12:56:52

标签: python tkinter label configure

labels = []
global labels
#blablbalabla code
welcome = Tkinter.Label(root,text= "Welcome to Fobby").place(x=250,y=250)
labels.append(welcome)
print labels
>>> [None]

有什么问题?标签是否与列表不兼容?

1 个答案:

答案 0 :(得分:5)

这是因为place()返回None:

labels = []
welcome = Tkinter.Label(root,text= "Welcome to Fobby")
welcome.place(x=250,y=250)
labels.append(welcome)
print labels