labels = []
global labels
#blablbalabla code
welcome = Tkinter.Label(root,text= "Welcome to Fobby").place(x=250,y=250)
labels.append(welcome)
print labels
>>> [None]
有什么问题?标签是否与列表不兼容?
答案 0 :(得分:5)
这是因为place()
返回None:
labels = []
welcome = Tkinter.Label(root,text= "Welcome to Fobby")
welcome.place(x=250,y=250)
labels.append(welcome)
print labels