aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-02-27 20:52:10 +0100
committerdavemds <dave@gurumeditation.it>2014-02-27 20:52:10 +0100
commitc2a34f20ad2ba457b768b66d2730617a1e0d7279 (patch)
treec866fc2fc17334055245300b4b0c9e9148dea177 /examples
parentPython-EFL: added 1.9 API: Colorselector.palette_items_get() (diff)
downloadpython-efl-c2a34f20ad2ba457b768b66d2730617a1e0d7279.tar.gz
Python-EFL: Colorselector new 1.9 API
Diffstat (limited to 'examples')
-rw-r--r--examples/elementary/test_colorselector.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/elementary/test_colorselector.py b/examples/elementary/test_colorselector.py
index 2021c31..becc14c 100644
--- a/examples/elementary/test_colorselector.py
+++ b/examples/elementary/test_colorselector.py
@@ -40,6 +40,15 @@ def cb_cs_item_lp(cs, item, rect):
b = (b * a) / 255
rect.color = (r, g, b, a)
+def selected_item_get(bt, cs):
+ item = cs.palette_selected_item_get()
+ print("Selected: {}".format(item.color if item is not None else None))
+
+def palette_items(bt, cs):
+ for item in cs.palette_items_get():
+ print("Item: {} {}".format(item.color, "<- selected" if item.selected else ""))
+
+
def colorselector_clicked(obj):
win = StandardWindow("colorselector", "ColorSelector test",
autodel=True, size=(350,350))
@@ -111,6 +120,23 @@ def colorselector_clicked(obj):
hbox.pack_end(bt)
bt.show()
+ hbox = Box(win, horizontal=True, size_hint_align=FILL_BOTH,
+ size_hint_weight=EXPAND_HORIZ)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ bt = Button(win, text="palette items", size_hint_align=FILL_BOTH,
+ size_hint_weight=EXPAND_HORIZ)
+ bt.callback_clicked_add(palette_items, cs)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = Button(win, text="palette selected item", size_hint_align=FILL_BOTH,
+ size_hint_weight=EXPAND_HORIZ)
+ bt.callback_clicked_add(selected_item_get, cs)
+ hbox.pack_end(bt)
+ bt.show()
+
win.show()