[英]How to get a user input in entry widget without button in tkinter python?
from tkinter import *
root = Tk()
label = Label(root, text="Name:")
label.pack()
e = Entry(root)
e.pack()
root.mainloop()
How do I get a user input in entry widget without button in tkinter?如何在 tkinter 中没有按钮的输入小部件中获取用户输入?
window = tk.Tk()
username = tk.Entry(window)
username.pack()
def it_has_been_written(*args):
#what you want to execute when user starts typing something
pass
username.trace_add("write", it_has_been_written)
window.mainloop()
To see more about this https://tkdocs.com/tutorial/widgets.html要查看有关此https 的更多信息://tkdocs.com/tutorial/widgets.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.