我是个编程新手,我一直在摆弄tkinter。
我的标签包含文本,它应该在更新字典值时更改。
下面是我的代码示例:
def setit(point, adic,number):
adic[point] = adic[point]+number
dict={'a':4,'b':8,'c':3}
aa=Label(root,text=dict['a']).pack()
bb=Label(root,text=dict['b']).pack()
cc=Label(root,text=dict['c']).pack()
Button(command=setit('a',dict,3)).pack()当按钮被按下时,我希望字典和适当的标签都更新。你会怎么做呢?最好不要使用OOP。谢谢!
https://stackoverflow.com/questions/47781434
复制相似问题