我在使用label.config(textvariable=texto)
时遇到问题。
因此,texto StringVar()似乎为空,因为没有显示“textovable”
import tkinter as tk
root = tk.Tk()
texto = tk.StringVar(value='Texto inicial')
texto.set(value='TextoVariable')
tk.Label(root, text='Hola Mundo').pack(anchor='nw')
label = tk.Label(root)
label.pack(anchor='center')
tk.Label(root, text='Hola Saturno').pack(anchor='se')
label.config(bg='green', fg='blue', font=('Verdana',24))
label.config(textvariable=texto)
root.mainloop()
目前没有回答
相关问题 更多 >
编程相关推荐