summaryrefslogtreecommitdiff
path: root/examples/elementary/test_image_memfile.py
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2017-02-26 21:29:11 +0100
committerDave Andreoli <dave@gurumeditation.it>2017-02-26 21:29:11 +0100
commita293b4e1244cf924174d02df3fd1d4d1e4c01117 (patch)
treeb3ceb4bae6839c6dfbf4c8995f3c2dff38a12c21 /examples/elementary/test_image_memfile.py
parente3224c882ae1e366d4380a22ea3ac1e8fe9804c7 (diff)
Split 2 elm.Image tests in 2 files
Diffstat (limited to 'examples/elementary/test_image_memfile.py')
-rw-r--r--examples/elementary/test_image_memfile.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/elementary/test_image_memfile.py b/examples/elementary/test_image_memfile.py
new file mode 100644
index 0000000..68dda58
--- /dev/null
+++ b/examples/elementary/test_image_memfile.py
@@ -0,0 +1,38 @@
1#!/usr/bin/env python
2# encoding: utf-8
3
4import os
5
6from efl import elementary as elm
7from efl.elementary import StandardWindow, Box, Image
8from efl.evas import EXPAND_BOTH, FILL_BOTH
9
10
11script_path = os.path.dirname(os.path.abspath(__file__))
12img_path = os.path.join(script_path, "images")
13
14
15def test_image_memfile(obj, it=None):
16 win = StandardWindow("image", "Image test", autodel=True, size=(320, 480))
17 if obj is None:
18 win.callback_delete_request_add(lambda o: elm.exit())
19
20 box = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
21 win.resize_object_add(box)
22 box.show()
23
24 im = Image(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
25
26 with open(os.path.join(img_path, "logo.png"), "rb") as fp:
27 image_data = fp.read()
28 im.memfile_set(image_data, len(image_data))
29 box.pack_end(im)
30 im.show()
31
32 win.show()
33
34
35if __name__ == "__main__":
36 elm.policy_set(elm.ELM_POLICY_QUIT, elm.ELM_POLICY_QUIT_LAST_WINDOW_CLOSED)
37 test_image_memfile(None)
38 elm.run()