# dialog.py -- Tkinter interface to the tk_dialog script.from tkinter import *from tkinter import _cnfmergeDIALOG_ICON = 'questhead'class Dialog(Widget):def __init__(self, master=None, cnf={}, **kw):cnf = _cnfmerge((cnf, kw))self.widgetName = '__dialog__'Widget._setup(self, master, cnf)self.num = self.tk.getint(self.tk.call('tk_dialog', self._w,cnf['title'], cnf['text'],cnf['bitmap'], cnf['default'],*cnf['strings']))try: Widget.destroy(self)except TclError: passdef destroy(self): passdef _test():d = Dialog(None, {'title': 'File Modified','text':'File "Python.h" has been modified'' since the last time it was saved.'' Do you want to save it before'' exiting the application.','bitmap': DIALOG_ICON,'default': 0,'strings': ('Save File','Discard Changes','Return to Editor')})print(d.num)if __name__ == '__main__':t = Button(None, {'text': 'Test','command': _test,Pack: {}})q = Button(None, {'text': 'Quit','command': t.quit,Pack: {}})t.mainloop()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。