【问题标题】:How can I edit the label after button is pressed [duplicate]按下按钮后如何编辑标签[重复]
【发布时间】:2020-05-24 20:16:39
【问题描述】:
button = Button(frame, text = "...", font = ('Courier', 14), command = lambda: principal_function(entry.get()))
button.place(relx = 0.7, relwidth = 0.3, relheight = 1)

label:

generalLabel = Label(lower_frame, text = '..', font = ("Courier", 22))
generalLabel.place(relwidth = 1, relheight = 1)`enter code here`
generalLabel.pack()

如果按下按钮,我想用新文本更新标签

【问题讨论】:

  • 这个网站上有几十个类似的问题。在问这个问题之前你有没有做任何研究?如果您告诉我们您搜索的内容,也许我们可以优化其中一个重复项,以便更容易找到。

标签: python tkinter


【解决方案1】:

这应该可以工作,更新标签的配置

generalLabel.config(text="changed")

【讨论】:

    猜你喜欢
    • 2018-09-13
    • 2020-10-21
    • 1970-01-01
    • 2014-10-18
    • 1970-01-01
    • 2020-07-22
    • 1970-01-01
    • 2015-04-06
    • 2011-09-03
    相关资源
    最近更新 更多