1. 程式人生 > >python對話框,並選擇yes/no

python對話框,並選擇yes/no

ack erro int tkinter 選擇 loop sorry callback 實現

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