Python编程关于tkinter图形用户界面编程的问题求助(新手求助!)

2024-11-23 22:16:11
推荐回答(1个)
回答1:

你好,下面是一个例子,你可以试试:
from tkinter import *
#import tkinter
import tkinter.messagebox as tm
import sys
#from Tkinter import *
#from tkMessageBox import *
def answer():
showerror("Answer", "Sorry, no answer available")
def callback():
if tm.askyesnocancel('Verify', 'Really quit?'):
print('Yes quit')
sys.exit(1)
else:
print('No')
Button(text='Quit', command=callback).pack(fill=X)
#Button(text='Answer', command=answer).pack(fill=X)
mainloop()