aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-02-27 22:38:04 +0100
committerdavemds <dave@gurumeditation.it>2014-02-27 22:38:04 +0100
commit32448918f6ebe7578e29e7269881f954284ddf9b (patch)
tree3bbfdd9b3beec555e70fe01d5e24c0ceb6abae23 /examples
parentPython-EFL: Colorselector new 1.9 API (diff)
downloadpython-efl-32448918f6ebe7578e29e7269881f954284ddf9b.tar.gz
Python-EFL: new 1.9 API Multibuttonentry.format_function_set()
Sadly this add 2 new points of reference leaks :(
Diffstat (limited to 'examples')
-rw-r--r--examples/elementary/test_multibuttonentry.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/elementary/test_multibuttonentry.py b/examples/elementary/test_multibuttonentry.py
index ede1fdb..e401461 100644
--- a/examples/elementary/test_multibuttonentry.py
+++ b/examples/elementary/test_multibuttonentry.py
@@ -61,6 +61,10 @@ def cb_print(btn, mbe):
for i in mbe.items:
print(i.text)
+def custom_format_func(count):
+ return "+ {} rabbits".format(count)
+
+
def multibuttonentry_clicked(obj, item=None):
win = StandardWindow("multibuttonentry", "MultiButtonEntry test",
autodel=True, size=(320, 320))
@@ -148,6 +152,23 @@ def multibuttonentry_clicked(obj, item=None):
hbox.pack_end(bt)
bt.show()
+
+ hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ bt = Button(win, text="Change format function",
+ size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ)
+ bt.callback_clicked_add(lambda b: mbe.format_function_set(custom_format_func))
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = Button(win, text="Unset format function",
+ size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ)
+ bt.callback_clicked_add(lambda b: mbe.format_function_set(None))
+ hbox.pack_end(bt)
+ bt.show()
+
mbe.focus = True
win.show()