Toplevel widget, e.g. for dialogs.
| 2883 | |
| 2884 | |
| 2885 | class Toplevel(BaseWidget, Wm): |
| 2886 | """Toplevel widget, e.g. for dialogs.""" |
| 2887 | |
| 2888 | def __init__(self, master=None, cnf={}, **kw): |
| 2889 | """Construct a toplevel widget with the parent MASTER. |
| 2890 | |
| 2891 | Valid option names: background, bd, bg, borderwidth, class, |
| 2892 | colormap, container, cursor, height, highlightbackground, |
| 2893 | highlightcolor, highlightthickness, menu, relief, screen, takefocus, |
| 2894 | use, visual, width.""" |
| 2895 | if kw: |
| 2896 | cnf = _cnfmerge((cnf, kw)) |
| 2897 | extra = () |
| 2898 | for wmkey in ['screen', 'class_', 'class', 'visual', |
| 2899 | 'colormap']: |
| 2900 | if wmkey in cnf: |
| 2901 | val = cnf[wmkey] |
| 2902 | # TBD: a hack needed because some keys |
| 2903 | # are not valid as keyword arguments |
| 2904 | if wmkey[-1] == '_': opt = '-'+wmkey[:-1] |
| 2905 | else: opt = '-'+wmkey |
| 2906 | extra = extra + (opt, val) |
| 2907 | del cnf[wmkey] |
| 2908 | BaseWidget.__init__(self, master, 'toplevel', cnf, {}, extra) |
| 2909 | root = self._root() |
| 2910 | self.iconname(root.iconname()) |
| 2911 | self.title(root.title()) |
| 2912 | self.protocol("WM_DELETE_WINDOW", self.destroy) |
| 2913 | |
| 2914 | |
| 2915 | class Button(Widget): |
no outgoing calls
searching dependent graphs…