简体   繁体   中英

How do you change the text of a tkinter label?

I am new to tkinter. how do you chnage the text of a label in tkinter after I press the button? thank you for your help

code

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()

I am new to tkinter. how do you chnage the text of a label in tkinter after I press the button? thank you for your help

code

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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