| # 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 tkFileDialog, |
| # tkColorChooser, and tkMessageBox to access the individual |
| # written by Fredrik Lundh, May 1997 |
| def __init__(self, master=None, **options): |
| # FIXME: should this be placed on the module level instead? |
| raise TclError, "this module requires Tk 4.2 or newer" |
| if not master and options.get('parent'): |
| self.master = options['parent'] |
| def _fixresult(self, widget, result): |
| def show(self, **options): |
| # update instance options |
| for k, v in options.items(): |
| # we need a dummy widget to properly process the options |
| # (at least as long as we use Tkinter 1.63) |
| s = w.tk.call(self.command, *w._options(self.options)) |
| s = self._fixresult(w, s) |