Construct a toplevel widget with the parent MASTER. Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, menu, relief, screen, takefocus, use, visual, width.
(self, master=None, cnf={}, **kw)
| 2803 | """Toplevel widget, e.g. for dialogs.""" |
| 2804 | |
| 2805 | def __init__(self, master=None, cnf={}, **kw): |
| 2806 | """Construct a toplevel widget with the parent MASTER. |
| 2807 | |
| 2808 | Valid resource names: background, bd, bg, borderwidth, class, |
| 2809 | colormap, container, cursor, height, highlightbackground, |
| 2810 | highlightcolor, highlightthickness, menu, relief, screen, takefocus, |
| 2811 | use, visual, width.""" |
| 2812 | if kw: |
| 2813 | cnf = _cnfmerge((cnf, kw)) |
| 2814 | extra = () |
| 2815 | for wmkey in ['screen', 'class_', 'class', 'visual', |
| 2816 | 'colormap']: |
| 2817 | if wmkey in cnf: |
| 2818 | val = cnf[wmkey] |
| 2819 | # TBD: a hack needed because some keys |
| 2820 | # are not valid as keyword arguments |
| 2821 | if wmkey[-1] == '_': opt = '-'+wmkey[:-1] |
| 2822 | else: opt = '-'+wmkey |
| 2823 | extra = extra + (opt, val) |
| 2824 | del cnf[wmkey] |
| 2825 | BaseWidget.__init__(self, master, 'toplevel', cnf, {}, extra) |
| 2826 | root = self._root() |
| 2827 | self.iconname(root.iconname()) |
| 2828 | self.title(root.title()) |
| 2829 | self.protocol("WM_DELETE_WINDOW", self.destroy) |
| 2830 | |
| 2831 | |
| 2832 | class Button(Widget): |