def __init__(self, text="", window=None, batch=None, group=None, theme=None, on_escape=None, have_focus=False): def on_ok(_): if on_escape is not None: on_escape(self) self.delete() button = FocusButton("Ok", on_press=on_ok) Manager.__init__(self, content=Frame(VerticalContainer( [Label(text), button])), window=window, batch=batch, group=group, theme=theme, is_movable=True) Manager.set_next_focus(self, 1)
def __init__(self, text="", ok="Ok", cancel="Cancel", window=None, batch=None, group=None, theme=None, on_ok=None, on_cancel=None): def on_ok_click(_): if on_ok is not None: on_ok(self) self.delete() def on_cancel_click(_): if on_cancel is not None: on_cancel(self) self.delete() Manager.__init__(self, content=Frame( VerticalContainer([ Label(text), HorizontalContainer([Button(ok, on_press=on_ok_click), None, Button(cancel, on_press=on_cancel_click)] )]) ), window=window, batch=batch, group=group, theme=theme, is_movable=True)