通过在没有按钮的情况下在TKINTER / PYTHON的入口框中输入输入框,添加带有标签的额外行
我想在不需要使用按钮的情况下在已经存在的输入框中键入一个数字后,看到新的标签和入口盒Apear。
我的循环可能也是错误的。但是我希望你有我的意图。这对我来说是全新的。
import tkinter as tk
window = tk.Tk()
label_amount = tk.Label(text="Amount")
label_amount.grid(row=0, column=0)
entry_amount = tk.Entry()
entry_amount.grid(row=0, column=1)
# TODO - create a label and entry * amount entered
# i = 1
# while i < int(entry_amount.get()):
# label_container = tk.Label(text=f"Container {i}")
# label_container.grid(row=i, column=1)
#
# entry_container = tk.Entry()
# entry_container.grid(row=i, column=2)
#
# i = i + 1
window.mainloop()
I would like to see new labels and entry boxes apear after I typed a number in an already existing entry box without having to use a button.
My while loop is probably also wrong. But I hope you get my intention. This is all new to me.
import tkinter as tk
window = tk.Tk()
label_amount = tk.Label(text="Amount")
label_amount.grid(row=0, column=0)
entry_amount = tk.Entry()
entry_amount.grid(row=0, column=1)
# TODO - create a label and entry * amount entered
# i = 1
# while i < int(entry_amount.get()):
# label_container = tk.Label(text=f"Container {i}")
# label_container.grid(row=i, column=1)
#
# entry_container = tk.Entry()
# entry_container.grid(row=i, column=2)
#
# i = i + 1
window.mainloop()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它起作用。
这是最终代码。
It worked.
This is the final code.