Example #1
0
    def open_modal(self, e):
        if self.modal_window:
            self.modal_window.shut()
            self.modal_window = None
        else:
            self.modal_window = Window(self.tk, "Modal window", modal=True)
            self.modal_window.append(StaticText(self.tk, "I'm a modal window"))
            self.modal_window.open()

            def handle_close(e):
                self.modal_window = None

            self.modal_window.close = handle_close
Example #2
0
    def open_a_lot(self, e):
        def hide_all():
            while self.lots:
                w = self.lots.pop()
                w.shut()
                w.destroy()

        if self.lots:
            hide_all()
            return

        for p in (("left", "top"), ("center", "top"), ("right", "top"),
                  ("left", "center"), ("center", ), ("right", "center"),
                  ("left", "bottom"), ("center", "bottom"), ("right",
                                                             "bottom")):
            l = ", ".join(p)
            w = Window(self.tk, l + " window", position=p)
            w.append(StaticText(self.tk, l))
            w.open()
            w.close = lambda e: hide_all()
            self.lots.append(w)