tkinter message问题
from tkinter import *messagebox.askokcancel('Demo','发射核弹?')
mainloop()
代码运行会报错,要怎么才能出对话框啊{:10_277:}
from tkinter import messagebox
这些对话框需要指定导入,用 * 导入不会顺带导入这些组件:
from tkinter import *
from tkinter import messagebox
messagebox.askokcancel('Demo','发射核弹?')
mainloop() from tkinter import messagebox
messagebox.askokcancel('Demo', '发射核弹?') 改成这样就好了:
from tkinter import *
from tkinter import messagebox
messagebox.askokcancel('Demo','发射核弹?')
mainloop()
页:
[1]