本文整理汇总了Python中efl.elementary.entry.Entry.callback_changed_add方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.callback_changed_add方法的具体用法?Python Entry.callback_changed_add怎么用?Python Entry.callback_changed_add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类efl.elementary.entry.Entry
的用法示例。
在下文中一共展示了Entry.callback_changed_add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: elm_input_events_clicked
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_changed_add [as 别名]
def elm_input_events_clicked(obj, item=None):
win = StandardWindow("inputevents", "Input Events Test", autodel=True)
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
box = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(box)
box.show()
entry = Entry(win, scrollable=True, size_hint_align=FILL_BOTH,
size_hint_weight=(1.0, 0.2))
entry.text = (
"This example will show how Elementary input events are handled. "
"Typing in this entry will log in the entry box below all events "
"caught by event handlers set to this Entry widget and its parent, "
"the Window widget. Key up events are checked for in the callback "
"and won't propagate to a parent widget."
)
entry.show()
log_entry = Entry(win, editable=False, scrollable=True, focus_allow=False,
size_hint_align=FILL_BOTH, size_hint_weight=(1.0, 0.8))
log_entry.callback_changed_add(changed_cb)
log_entry.show()
btn = Button(win, text="Clear log", focus_allow=False)
btn.callback_clicked_add(lambda x: setattr(log_entry, "entry", ""))
btn.show()
box.pack_end(entry)
box.pack_end(log_entry)
box.pack_end(btn)
entry.elm_event_callback_add(events_cb, log_entry)
entry.markup_filter_append(filter_cb)
win.elm_event_callback_add(events_cb, log_entry)
win.resize(640, 480)
win.show()
entry.focus = True
示例2: Box
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_changed_add [as 别名]
box0.pack_end(tg)
tg.show()
bx1 = Box(win, size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
size_hint_align=(EVAS_HINT_FILL, 0.0), horizontal=True)
box0.pack_end(bx1)
bx1.show()
lb = Label(win, text="Filter:")
bx1.pack_end(lb)
lb.show()
en = Entry(win, single_line=True, scrollable=True,
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
en.part_text_set("guide", "Type widget name here to search.")
en.callback_changed_add(cb_filter, win)
bx1.pack_end(en)
en.show()
en.focus_set(True)
sc = Scroller(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
bounce=(False, True))
sc.show()
box0.pack_end(sc)
tbx = Box(win, size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
size_hint_align=(EVAS_HINT_FILL, 0.0))
sc.content_set(tbx)
tbx.show()
menu_create(None, win)
示例3: EmbeddedTerminal
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_changed_add [as 别名]
class EmbeddedTerminal(Box):
def __init__(self, parent_widget, titles=None, *args, **kwargs):
Box.__init__(self, parent_widget, *args, **kwargs)
self.outPut = Entry(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
self.outPut.editable_set(False)
self.outPut.scrollable_set(True)
self.outPut.callback_changed_add(self.changedCb)
self.outPut.show()
frame = Frame(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
frame.text = "Input:"
frame.autocollapse_set(True)
frame.collapse_go(True)
frame.show()
bx = Box(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
bx.horizontal = True
bx.show()
frame.content = bx
self.inPut = Entry(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
self.inPut.single_line_set(True)
self.inPut.callback_activated_add(self.enterPressed)
self.inPut.show()
enterButton = Button(self)
enterButton.text = "Execute"
enterButton.callback_pressed_add(self.enterPressed)
enterButton.show()
bx.pack_end(self.inPut)
bx.pack_end(enterButton)
self.pack_end(self.outPut)
self.pack_end(frame)
self.cmd_exe = None
self.done_cb = None
def changedCb(self, obj):
obj.cursor_end_set()
def enterPressed(self, btn):
if not self.cmd_exe:
self.runCommand(self.inPut.text)
self.inPut.text = ""
else:
ourResult = self.cmd_exe.send("%s\n" % self.inPut.text)
self.inPut.text = ""
def runCommand(self, command, done_cb=None):
self.cmd_exe = cmd = ecore.Exe(
command, ecore.ECORE_EXE_PIPE_READ | ecore.ECORE_EXE_PIPE_ERROR | ecore.ECORE_EXE_PIPE_WRITE
)
cmd.on_add_event_add(self.command_started)
cmd.on_data_event_add(self.received_data)
cmd.on_error_event_add(self.received_error)
cmd.on_del_event_add(self.command_done)
self.done_cb = done_cb
def command_started(self, cmd, event, *args, **kwargs):
self.outPut.entry_append("---------------------------------")
self.outPut.entry_append("<br>")
def received_data(self, cmd, event, *args, **kwargs):
self.outPut.entry_append("%s" % event.data)
self.outPut.entry_append("<br>")
def received_error(self, cmd, event, *args, **kwargs):
self.outPut.entry_append("Error: %s" % event.data)
def command_done(self, cmd, event, *args, **kwargs):
self.outPut.entry_append("---------------------------------")
self.outPut.entry_append("<br>")
self.cmd_exe = None
if self.done_cb:
if callable(self.done_cb):
self.done_cb()