python对话框,并选择yes/no

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python对话框,并选择yes/no相关的知识,希望对你有一定的参考价值。

python 自带的 tkinter 库 是这样实现的

#!/usr/bin/python
# -*- coding: UTF-8 -*-

from Tkinter import *
 
from tkMessageBox import *
 
def answer():
 
    showerror("Answer", "Sorry, no answer available")
    
def callback():
 
     askyesno(‘Verify‘, ‘Really quit?‘)
 
 
Button(text=‘YE‘, command=callback).pack(fill=X)
 
Button(text=‘NO‘, command=answer).pack(fill=X)
 
mainloop()























以上是关于python对话框,并选择yes/no的主要内容,如果未能解决你的问题,请参考以下文章