[英]How after tkinter.messagebox then entry
ready = tkinter.messagebox.askyesno("Guess", "Are you ready?")
def func():
entry = Entry(windows,bg = "lightblue")
entry.pack()
if ready == False:
windows.quit()
else:
func()
I just start learn tkinter and try to practice it.我刚开始学习 tkinter 并尝试练习它。 When i do the messagebox, i could'n entry anything in the box.
当我做消息框时,我无法在框中输入任何内容。 How could I fix it, thank you very much.
怎么解决,非常感谢。
I guess you can't use tkinter.messagebox
directly.我猜你不能直接使用
tkinter.messagebox
。 But if you import this, you will face no issue.但是,如果您导入它,您将不会遇到任何问题。 I have just made a little modification to your code and now it's working fine.
我刚刚对您的代码进行了一些修改,现在它工作正常。
import tkinter
import tkinter.messagebox as message
windows = tkinter.Tk()
ready = message.askyesno("ready?")
#print(ready)
def func():
e = tkinter.Entry(windows, bg="lightblue")
e.pack()
if ready == False:
windows.quit()
else:
func()
windows.mainloop()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.