【发布时间】:2021-06-29 08:14:55
【问题描述】:
我想更改此标签,因此我使用了widget.config 选项,但由于某种原因它无法正常工作。这是我的代码:
import tkinter as tk
root = tk.Tk()
root.attributes('-fullscreen', True)
exit_button = tk.Button(root, text="Exit", command = root.destroy)
exit_button.place(x=1506, y=0)
def answer():
global main_entry
answer_label.config(main_entry)
frame = tk.Frame(root)
main_entry = tk.Entry(frame, width=100)
main_entry.grid(row=0, column=0)
go_button = tk.Button(frame, text='Go!', width=85, command = answer)
go_button.grid(row=1, column=0)
answer_label = tk.Label(text = "Hey").pack()
frame.place(relx=.5, rely=.5, anchor='center')
root.mainloop()
【问题讨论】:
标签: python user-interface tkinter pycharm widget