我想要做的是制作一个程序,当您在输入框中按Enter键时,它会更改窗口标题
import tkinter
window = tkinter.Tk()
title = window.title("1")
def name(event):
title.configure("2")
Name = tkinter.Entry(window)
Name.bind("<Return>", name)
Name.pack()
window.mainloop()
非常欢迎任何帮助!
答案 0 :(得分:0)
import tkinter
window = tkinter.Tk()
title = window.title("1")
def name(event):
window.title("2")
Name = tkinter.Entry(window)
Name.bind("<Return>", name)
Name.pack()
window.mainloop()
答案 1 :(得分:0)
Change the window title with Tk.title function.
window.title("TITLE")
This will change the title.
def name(event=None):
window.title("Hello, %s!"%Name.get())