首页 > 代码库 > python对话框,并选择yes/no

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