def focus3_clicked(obj, item=None): win = StandardWindow("focus3", "Focus 3", autodel=True, size=(320, 480)) win.focus_highlight_enabled = True bx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bx) bx.show() en = Entry(win, scrollable=True, single_line=True, text="An entry", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) en.callback_focused_add(_focused_cb) en.callback_unfocused_add(_unfocused_cb) bx.pack_end(en) en.show() bt = Button(win, text="Add", focus_allow=False, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bt.callback_clicked_add(_add_cb, win, bx) bx.pack_end(bt) bt.show() bt = Button(win, text="Del", focus_allow=False, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bt.callback_clicked_add(_del_cb, bx) bx.pack_end(bt) bt.show() bt = Button(win, text="hide", focus_allow=False, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bt.callback_clicked_add(_hide_cb) bx.pack_end(bt) bt.show() win.show()
def _add_cb(bt, win, bx): en = Entry(win, scrollable=True, single_line=True, text="An entry", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) en.callback_focused_add(_focused_cb) en.callback_unfocused_add(_unfocused_cb) bx.pack_start(en) en.show()