# base class for tk common dialogues## this module provides a base class for accessing the common# dialogues available in Tk 4.2 and newer. use filedialog,# colorchooser, and messagebox to access the individual# dialogs.## written by Fredrik Lundh, May 1997#from tkinter import *class Dialog:command = Nonedef __init__(self, master=None, **options):self.master = masterself.options = optionsif not master and options.get('parent'):self.master = options['parent']def _fixoptions(self):pass # hookdef _fixresult(self, widget, result):return result # hookdef show(self, **options):# update instance optionsfor k, v in options.items():self.options[k] = vself._fixoptions()# we need a dummy widget to properly process the options# (at least as long as we use Tkinter 1.63)w = Frame(self.master)try:s = w.tk.call(self.command, *w._options(self.options))s = self._fixresult(w, s)finally:try:# get rid of the widgetw.destroy()except:passreturn s
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。