Toplevel widget, e.g. for dialogs.
| 2671 | |
| 2672 | |
| 2673 | class Toplevel(BaseWidget, Wm): |
| 2674 | """Toplevel widget, e.g. for dialogs.""" |
| 2675 | |
| 2676 | def __init__(self, master=None, cnf={}, **kw): |
| 2677 | """Construct a toplevel widget with the parent MASTER. |
| 2678 | |
| 2679 | Valid resource names: background, bd, bg, borderwidth, class, |
| 2680 | colormap, container, cursor, height, highlightbackground, |
| 2681 | highlightcolor, highlightthickness, menu, relief, screen, takefocus, |
| 2682 | use, visual, width.""" |
| 2683 | if kw: |
| 2684 | cnf = _cnfmerge((cnf, kw)) |
| 2685 | extra = () |
| 2686 | for wmkey in ['screen', 'class_', 'class', 'visual', |
| 2687 | 'colormap']: |
| 2688 | if wmkey in cnf: |
| 2689 | val = cnf[wmkey] |
| 2690 | # TBD: a hack needed because some keys |
| 2691 | # are not valid as keyword arguments |
| 2692 | if wmkey[-1] == '_': opt = '-'+wmkey[:-1] |
| 2693 | else: opt = '-'+wmkey |
| 2694 | extra = extra + (opt, val) |
| 2695 | del cnf[wmkey] |
| 2696 | BaseWidget.__init__(self, master, 'toplevel', cnf, {}, extra) |
| 2697 | root = self._root() |
| 2698 | self.iconname(root.iconname()) |
| 2699 | self.title(root.title()) |
| 2700 | self.protocol("WM_DELETE_WINDOW", self.destroy) |
| 2701 | |
| 2702 | |
| 2703 | class Button(Widget): |
no outgoing calls