summaryrefslogtreecommitdiff
path: root/examples/elementary/test_multibuttonentry.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-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):
61 for i in mbe.items: 61 for i in mbe.items:
62 print(i.text) 62 print(i.text)
63 63
64def custom_format_func(count):
65 return "+ {} rabbits".format(count)
66
67
64def multibuttonentry_clicked(obj, item=None): 68def multibuttonentry_clicked(obj, item=None):
65 win = StandardWindow("multibuttonentry", "MultiButtonEntry test", 69 win = StandardWindow("multibuttonentry", "MultiButtonEntry test",
66 autodel=True, size=(320, 320)) 70 autodel=True, size=(320, 320))
@@ -148,6 +152,23 @@ def multibuttonentry_clicked(obj, item=None):
148 hbox.pack_end(bt) 152 hbox.pack_end(bt)
149 bt.show() 153 bt.show()
150 154
155
156 hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ)
157 vbox.pack_end(hbox)
158 hbox.show()
159
160 bt = Button(win, text="Change format function",
161 size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ)
162 bt.callback_clicked_add(lambda b: mbe.format_function_set(custom_format_func))
163 hbox.pack_end(bt)
164 bt.show()
165
166 bt = Button(win, text="Unset format function",
167 size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ)
168 bt.callback_clicked_add(lambda b: mbe.format_function_set(None))
169 hbox.pack_end(bt)
170 bt.show()
171
151 mbe.focus = True 172 mbe.focus = True
152 173
153 win.show() 174 win.show()