5 # base class for tk common dialogues
7 # this module provides a base class for accessing the common
8 # dialogues available in Tk 4.2 and newer. use tkFileDialog,
9 # tkColorChooser, and tkMessageBox to access the individual
12 # written by Fredrik Lundh, May 1997
22 def __init__(self
, master
=None, **options
):
24 # FIXME: should this be placed on the module level instead?
26 raise TclError
, "this module requires Tk 4.2 or newer"
29 self
.options
= options
30 if not master
and options
.get('parent'):
31 self
.master
= options
['parent']
33 def _fixoptions(self
):
36 def _fixresult(self
, widget
, result
):
39 def show(self
, **options
):
41 # update instance options
42 for k
, v
in options
.items():
47 # we need a dummy widget to properly process the options
48 # (at least as long as we use Tkinter 1.63)
49 w
= Frame(self
.master
)
53 s
= apply(w
.tk
.call
, (self
.command
,) + w
._options
(self
.options
))
55 s
= self
._fixresult
(w
, s
)
60 # get rid of the widget