繁体   English   中英

如何更改 tkinter label 的文本?

[英]How do you change the text of a tkinter label?

我是 tkinter 的新手。 按下按钮后,如何在 tkinter 中更改 label 的文本? 谢谢您的帮助

代码

import tkinter
root = tkinter.Tk()

def gotothenextstep():
    print('I need help here. How do I change the text of the label?')

label = tkinter.Label(root, text='Click the button to go to the next step:')
button = tkinter.Button(root, text='Click me', command=gotothenextstep)
label.grid(row=10, column=100)
button.grid(row=10, column=200)
root.mainloop()

我是 tkinter 的新手。 按下按钮后,如何在 tkinter 中更改 label 的文本? 谢谢您的帮助

代码

import tkinter
root = tkinter.Tk()

def gotothenextstep():
    print('I need help here. How do I change the text of the label?')

label = tkinter.Label(root, text='Click the button to go to the next step:')
button = tkinter.Button(root, text='Click me', command=gotothenextstep)
label.grid(row=10, column=100)
button.grid(row=10, column=200)
root.mainloop()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM