├── .gitignore ├── README.md ├── ecore-Exe-tutorial └── ecore-command-example.py ├── license.txt ├── tut1-hello-elementary ├── ex1-helloelementary.py ├── ex2-helloelementary.py └── screenshots │ ├── example1-noexpand.png │ ├── example1.png │ └── example2.png ├── tut2-weight-hints ├── ex3-weight.py └── screenshots │ └── example3.png ├── tut3-align-hints ├── ex4-alignment.py └── screenshots │ └── example4.png ├── tut4-displaying-images ├── ex5-displaystatic.py ├── ex6-displayselected.py ├── images │ └── logo.png └── screenshots │ ├── example5.png │ └── example6.png ├── tut5-naviframe ├── ex7-naviframe.py ├── images │ └── logo.png └── screenshots │ ├── example7-2.png │ └── example7.png ├── tut6-elmextensions ├── aboutvars.py ├── ex8-elmex.py └── screenshots │ ├── example8-2.png │ ├── example8-3.png │ └── example8.png ├── tut7-lists ├── ex10-searchablelist.py ├── ex9-list.py ├── listitems.py └── screenshots │ ├── example10.png │ └── example9.png ├── tut8-genlist ├── ex11-genlist.py └── listitems.py └── tut9-customwidget ├── ex12-customwidget.py ├── images └── logo.png └── screenshot └── example12.png /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A series of Elementary Python tutorials. 2 | 3 | [Python Elementary Reference Docs](https://build.enlightenment.org/job/base_pyefl_build/lastSuccessfulBuild/artifact/build/sphinx/html/index.html) 4 | 5 | Tutorials: 6 | - 1.) [Hello Elementary](https://www.toolbox.com/tech/operating-systems/blogs/py-efl-tutorial-1-hello-elementary-022415/) 7 | - 2.) [Weight Hints](https://www.toolbox.com/tech/operating-systems/blogs/py-efl-tutorial-2-weight-hints-031215/) 8 | - 3.) [Align Hints](https://www.toolbox.com/tech/operating-systems/blogs/py-efl-tutorial-3-align-hints-041415/) 9 | - 4.) [Images / FileselectorButton](https://www.toolbox.com/tech/operating-systems/blogs/py-efl-tutorial-4-displaying-images-042415/) 10 | - 5.) [Naviframe](https://www.toolbox.com/tech/operating-systems/blogs/py-efl-tutorial-5-naviframe-070115/) 11 | - 6.) [Elm Extensions](https://www.toolbox.com/tech/operating-systems/blogs/py-efl-tutorial-6-elmextensions-110115/) 12 | - 7.) [Lists](https://www.toolbox.com/tech/operating-systems/blogs/pyefl-tutorial-7-lists-111115/) 13 | - 8.) [Genlist](https://www.toolbox.com/tech/programming/blogs/pyefl-tutorial-8-genlist-120215/) 14 | - 9.) [Custom Widgets](https://www.toolbox.com/tech/operating-systems/blogs/py-efl-tutorial-9-custom-elementary-widgets-020116/) 15 | - 10.) [Desktop Integration] 16 | - 11.) [Layout Widgets] 17 | 18 | Credits: 19 | - [Jeff Hoogland](http://www.jeffhoogland.com/) 20 | - [Kai Huuhko](https://github.com/kaihu) 21 | -------------------------------------------------------------------------------- /ecore-Exe-tutorial/ecore-command-example.py: -------------------------------------------------------------------------------- 1 | """ 2 | A simple example on how to use ecore.Exe to interact with a command 3 | 4 | Usage: 5 | python ecore-command-example-py 6 | 7 | Text you put in the entry box is piped to the running command when you press the send button 8 | """ 9 | 10 | import sys 11 | from efl import ecore 12 | from efl import evas 13 | from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL 14 | from efl import elementary 15 | from efl.elementary.window import Window, ELM_WIN_DIALOG_BASIC 16 | from efl.elementary.box import Box 17 | from efl.elementary.button import Button 18 | from efl.elementary.entry import Entry 19 | 20 | EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 21 | EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0 22 | FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL 23 | FILL_HORIZ = EVAS_HINT_FILL, 0.5 24 | ALIGN_CENTER = 0.5, 0.5 25 | 26 | class ourCommand(object): 27 | def __init__(self, cmd): 28 | self.cmd = cmd 29 | self.cmd_exe = None 30 | 31 | win = self.win = Window("ecore-ex", ELM_WIN_DIALOG_BASIC) 32 | win.title = "Ecore Example" 33 | win.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND 34 | win.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL 35 | win.resize(300, 200) 36 | win.callback_delete_request_add(lambda o: elementary.exit()) 37 | win.show() 38 | win.activate() 39 | 40 | self.sendEntry = Entry(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) 41 | self.sendEntry.show() 42 | 43 | self.sendButton = Button(win, size_hint_weight=EXPAND_HORIZ, 44 | size_hint_align=FILL_HORIZ) 45 | self.sendButton.text = "Send!" 46 | self.sendButton.callback_pressed_add(self.sendPressed) 47 | self.sendButton.show() 48 | 49 | box = Box(win, size_hint_weight=EXPAND_HORIZ, 50 | size_hint_align=FILL_HORIZ) 51 | box.pack_end(self.sendEntry) 52 | box.pack_end(self.sendButton) 53 | box.show() 54 | 55 | win.resize_object_add(box) 56 | 57 | self.run_command(cmd) 58 | 59 | def sendPressed(self, btn): 60 | print "Sending Data: %s"%(self.sendEntry.text) 61 | if self.cmd_exe: 62 | ourResult = self.cmd_exe.send("%s\n"%self.sendEntry.text) 63 | print("Send Success: %s"%ourResult) 64 | self.sendEntry.text = "" 65 | 66 | def run_command(self, command): 67 | self.cmd_exe = cmd = ecore.Exe( 68 | command, 69 | ecore.ECORE_EXE_PIPE_READ | 70 | ecore.ECORE_EXE_PIPE_ERROR | 71 | ecore.ECORE_EXE_PIPE_WRITE 72 | ) 73 | cmd.on_add_event_add(self.command_started) 74 | cmd.on_data_event_add(self.received_data) 75 | cmd.on_error_event_add(self.received_error) 76 | cmd.on_del_event_add(self.command_done) 77 | 78 | def command_started(self, cmd, event, *args, **kwargs): 79 | print("Command started.\n") 80 | 81 | def received_data(self, cmd, event, *args, **kwargs): 82 | print("Output: %s"%event.data) 83 | 84 | def received_error(self, cmd, event, *args, **kwargs): 85 | print("Error: %s" % event.data) 86 | 87 | def command_done(self, cmd, event, *args, **kwargs): 88 | print("Command done.") 89 | elementary.exit() 90 | 91 | 92 | if __name__ == "__main__": 93 | cmd = " ".join(sys.argv[1:]) 94 | 95 | elementary.init() 96 | 97 | start = ourCommand(cmd) 98 | 99 | elementary.run() 100 | elementary.shutdown() 101 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | This license applies to all files in this repository that do not have 2 | another license otherwise indicated. 3 | 4 | Copyright (c) 2014, Jeff Hoogland 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | * Neither the name of the nor the 15 | names of its contributors may be used to endorse or promote products 16 | derived from this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 22 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /tut1-hello-elementary/ex1-helloelementary.py: -------------------------------------------------------------------------------- 1 | import efl.elementary as elm 2 | from efl.elementary.window import StandardWindow 3 | from efl.elementary.label import Label 4 | 5 | from efl.evas import EVAS_HINT_EXPAND 6 | EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 7 | 8 | class MainWindow(StandardWindow): 9 | def __init__(self): 10 | StandardWindow.__init__(self, "ex1", "Hello Elementary", size=(300, 200)) 11 | self.callback_delete_request_add(lambda o: elm.exit()) 12 | 13 | ourLabel = Label(self) 14 | ourLabel.size_hint_weight = EXPAND_BOTH 15 | ourLabel.text = "Hello Elementary!" 16 | ourLabel.show() 17 | 18 | self.resize_object_add(ourLabel) 19 | 20 | if __name__ == "__main__": 21 | elm.init() 22 | GUI = MainWindow() 23 | GUI.show() 24 | elm.run() 25 | elm.shutdown() 26 | -------------------------------------------------------------------------------- /tut1-hello-elementary/ex2-helloelementary.py: -------------------------------------------------------------------------------- 1 | import efl.elementary as elm 2 | from efl.elementary.window import StandardWindow 3 | from efl.elementary.label import Label 4 | from efl.elementary.button import Button 5 | from efl.elementary.box import Box 6 | 7 | from efl.evas import EVAS_HINT_EXPAND 8 | EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 9 | 10 | class MainWindow(StandardWindow): 11 | def __init__(self): 12 | StandardWindow.__init__(self, "ex2", "Hello Elementary", size=(300, 200)) 13 | self.callback_delete_request_add(lambda o: elm.exit()) 14 | 15 | ourLabel = Label(self) 16 | ourLabel.size_hint_weight = EXPAND_BOTH 17 | ourLabel.text = "Hello Elementary!" 18 | ourLabel.show() 19 | 20 | ourButton = Button(self) 21 | ourButton.size_hint_weight = EXPAND_BOTH 22 | ourButton.text = "Goodbye Elementary" 23 | ourButton.callback_clicked_add(self.buttonPressed) 24 | ourButton.show() 25 | 26 | ourBox = Box(self) 27 | ourBox.size_hint_weight = EXPAND_BOTH 28 | ourBox.pack_end(ourLabel) 29 | ourBox.pack_end(ourButton) 30 | ourBox.show() 31 | 32 | self.resize_object_add(ourBox) 33 | 34 | def buttonPressed(self, btn): 35 | elm.exit() 36 | 37 | if __name__ == "__main__": 38 | elm.init() 39 | GUI = MainWindow() 40 | GUI.show() 41 | elm.run() 42 | elm.shutdown() 43 | -------------------------------------------------------------------------------- /tut1-hello-elementary/screenshots/example1-noexpand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut1-hello-elementary/screenshots/example1-noexpand.png -------------------------------------------------------------------------------- /tut1-hello-elementary/screenshots/example1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut1-hello-elementary/screenshots/example1.png -------------------------------------------------------------------------------- /tut1-hello-elementary/screenshots/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut1-hello-elementary/screenshots/example2.png -------------------------------------------------------------------------------- /tut2-weight-hints/ex3-weight.py: -------------------------------------------------------------------------------- 1 | import efl.elementary as elm 2 | from efl.elementary.window import StandardWindow 3 | from efl.elementary.button import Button 4 | from efl.elementary.box import Box 5 | 6 | from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL 7 | EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 8 | FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL 9 | 10 | class MainWindow(StandardWindow): 11 | def __init__(self): 12 | StandardWindow.__init__(self, "ex3", "Weight Example", size=(300, 400)) 13 | self.callback_delete_request_add(lambda o: elm.exit()) 14 | 15 | ourButton = Button(self) 16 | ourButton.size_hint_weight = (0, 0) 17 | ourButton.size_hint_align = FILL_BOTH 18 | ourButton.text = "Button 1" 19 | ourButton.show() 20 | 21 | ourButton2 = Button(self) 22 | ourButton2.size_hint_weight = EXPAND_BOTH 23 | ourButton2.size_hint_align = FILL_BOTH 24 | ourButton2.text = "Button 2" 25 | ourButton2.show() 26 | 27 | ourButton3 = Button(self) 28 | ourButton3.size_hint_weight = (0, 0.5) 29 | ourButton3.size_hint_align = FILL_BOTH 30 | ourButton3.text = "Button 3" 31 | ourButton3.show() 32 | 33 | ourBox = Box(self) 34 | ourBox.size_hint_weight = EXPAND_BOTH 35 | ourBox.pack_end(ourButton) 36 | ourBox.pack_end(ourButton2) 37 | ourBox.pack_end(ourButton3) 38 | ourBox.show() 39 | 40 | self.resize_object_add(ourBox) 41 | 42 | if __name__ == "__main__": 43 | elm.init() 44 | GUI = MainWindow() 45 | GUI.show() 46 | elm.run() 47 | elm.shutdown() 48 | -------------------------------------------------------------------------------- /tut2-weight-hints/screenshots/example3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut2-weight-hints/screenshots/example3.png -------------------------------------------------------------------------------- /tut3-align-hints/ex4-alignment.py: -------------------------------------------------------------------------------- 1 | import efl.elementary as elm 2 | from efl.elementary.window import StandardWindow 3 | from efl.elementary.button import Button 4 | from efl.elementary.box import Box 5 | 6 | from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL 7 | EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 8 | FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL 9 | 10 | class MainWindow(StandardWindow): 11 | def __init__(self): 12 | StandardWindow.__init__(self, "ex4", "Align Example", size=(300, 200)) 13 | self.callback_delete_request_add(lambda o: elm.exit()) 14 | 15 | ourButton = Button(self) 16 | ourButton.size_hint_weight = EXPAND_BOTH 17 | ourButton.size_hint_align = (0, 0) 18 | ourButton.text = "Button 1" 19 | ourButton.show() 20 | 21 | ourButton2 = Button(self) 22 | ourButton2.size_hint_weight = EXPAND_BOTH 23 | ourButton2.size_hint_align = FILL_BOTH 24 | ourButton2.text = "Button 2" 25 | ourButton2.show() 26 | 27 | ourButton3 = Button(self) 28 | ourButton3.size_hint_weight = EXPAND_BOTH 29 | ourButton3.size_hint_align = (1, 1) 30 | ourButton3.text = "Button 3" 31 | ourButton3.show() 32 | 33 | ourBox = Box(self) 34 | ourBox.size_hint_weight = EXPAND_BOTH 35 | ourBox.pack_end(ourButton) 36 | ourBox.pack_end(ourButton2) 37 | ourBox.pack_end(ourButton3) 38 | ourBox.show() 39 | 40 | self.resize_object_add(ourBox) 41 | 42 | if __name__ == "__main__": 43 | elm.init() 44 | GUI = MainWindow() 45 | GUI.show() 46 | elm.run() 47 | elm.shutdown() 48 | -------------------------------------------------------------------------------- /tut3-align-hints/screenshots/example4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut3-align-hints/screenshots/example4.png -------------------------------------------------------------------------------- /tut4-displaying-images/ex5-displaystatic.py: -------------------------------------------------------------------------------- 1 | import efl.elementary as elm 2 | from efl.elementary.window import StandardWindow 3 | from efl.elementary.image import Image 4 | 5 | from efl.evas import EVAS_HINT_EXPAND 6 | EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 7 | 8 | class MainWindow(StandardWindow): 9 | def __init__(self): 10 | StandardWindow.__init__(self, "ex5", "Static Image", size=(300, 200)) 11 | self.callback_delete_request_add(lambda o: elm.exit()) 12 | 13 | ourImage = Image(self) 14 | ourImage.size_hint_weight = EXPAND_BOTH 15 | ourImage.file_set("images/logo.png") 16 | ourImage.tooltip_text_set("A picture!") 17 | ourImage.show() 18 | 19 | self.resize_object_add(ourImage) 20 | 21 | if __name__ == "__main__": 22 | elm.init() 23 | GUI = MainWindow() 24 | GUI.show() 25 | elm.run() 26 | elm.shutdown() 27 | -------------------------------------------------------------------------------- /tut4-displaying-images/ex6-displayselected.py: -------------------------------------------------------------------------------- 1 | import os 2 | import efl.elementary as elm 3 | from efl.elementary.window import StandardWindow 4 | from efl.elementary.image import Image 5 | from efl.elementary.box import Box 6 | from efl.elementary.fileselector_button import FileselectorButton 7 | 8 | from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL 9 | EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 10 | EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0 11 | FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL 12 | 13 | class MainWindow(StandardWindow): 14 | def __init__(self): 15 | StandardWindow.__init__(self, "ex6", "Selected Image", size=(300, 200)) 16 | self.callback_delete_request_add(lambda o: elm.exit()) 17 | 18 | self.ourImage = ourImage = Image(self) 19 | ourImage.size_hint_weight = EXPAND_BOTH 20 | ourImage.size_hint_align = FILL_BOTH 21 | ourImage.file_set("images/logo.png") 22 | ourImage.tooltip_text_set("A picture!") 23 | ourImage.show() 24 | 25 | ourButton = FileselectorButton(self) 26 | ourButton.size_hint_weight = EXPAND_HORIZ 27 | ourButton.text = "Select new Image" 28 | ourButton.callback_file_chosen_add(self.fileSelected) 29 | ourButton.show() 30 | 31 | ourBox = Box(self) 32 | ourBox.size_hint_weight = EXPAND_BOTH 33 | ourBox.pack_end(ourImage) 34 | ourBox.pack_end(ourButton) 35 | ourBox.show() 36 | 37 | self.resize_object_add(ourBox) 38 | 39 | def fileSelected(self, fsb, selectedFile): 40 | if selectedFile: 41 | validExtensions = [".png", ".jpg", ".gif"] 42 | 43 | fileName, fileExtension = os.path.splitext(selectedFile) 44 | 45 | if fileExtension in validExtensions: 46 | self.ourImage.file_set(selectedFile) 47 | 48 | if __name__ == "__main__": 49 | elm.init() 50 | GUI = MainWindow() 51 | GUI.show() 52 | elm.run() 53 | elm.shutdown() 54 | -------------------------------------------------------------------------------- /tut4-displaying-images/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut4-displaying-images/images/logo.png -------------------------------------------------------------------------------- /tut4-displaying-images/screenshots/example5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut4-displaying-images/screenshots/example5.png -------------------------------------------------------------------------------- /tut4-displaying-images/screenshots/example6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut4-displaying-images/screenshots/example6.png -------------------------------------------------------------------------------- /tut5-naviframe/ex7-naviframe.py: -------------------------------------------------------------------------------- 1 | import efl.elementary as elm 2 | from efl.elementary.window import StandardWindow 3 | from efl.elementary.image import Image 4 | from efl.elementary.label import Label 5 | from efl.elementary.button import Button 6 | from efl.elementary.box import Box 7 | from efl.elementary.naviframe import Naviframe 8 | 9 | from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL 10 | EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 11 | EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0 12 | FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL 13 | 14 | class MainWindow(StandardWindow): 15 | def __init__(self): 16 | StandardWindow.__init__(self, "ex7", "Naviframe", size=(300, 200)) 17 | self.callback_delete_request_add(lambda o: elm.exit()) 18 | 19 | staticImage = staticImage = Image(self) 20 | staticImage.size_hint_weight = EXPAND_BOTH 21 | staticImage.file_set("images/logo.png") 22 | staticImage.tooltip_text_set("A picture!") 23 | staticImage.show() 24 | 25 | ourLabel = ourLabel = Label(self) 26 | ourLabel.size_hint_weight = EXPAND_BOTH 27 | ourLabel.text = "Hey look some text!" 28 | ourLabel.show() 29 | 30 | self.nf = Naviframe(self) 31 | self.nf.size_hint_weight = EXPAND_BOTH 32 | self.nf.size_hint_align = FILL_BOTH 33 | self.nf.show() 34 | 35 | buttonOne = Button(self) 36 | buttonOne.size_hint_weight = EXPAND_BOTH 37 | buttonOne.text = "Show image" 38 | buttonOne.callback_clicked_add(self.buttonPressed, staticImage) 39 | buttonOne.show() 40 | 41 | buttonTwo = Button(self) 42 | buttonTwo.size_hint_weight = EXPAND_BOTH 43 | buttonTwo.text = "Show label" 44 | buttonTwo.callback_clicked_add(self.buttonPressed, ourLabel) 45 | buttonTwo.show() 46 | 47 | buttonBox = Box(self) 48 | buttonBox.size_hint_weight = EXPAND_HORIZ 49 | buttonBox.horizontal_set(True) 50 | buttonBox.pack_end(buttonOne) 51 | buttonBox.pack_end(buttonTwo) 52 | buttonBox.show() 53 | 54 | mainBox = Box(self) 55 | mainBox.size_hint_weight = EXPAND_BOTH 56 | mainBox.pack_end(self.nf) 57 | mainBox.pack_end(buttonBox) 58 | mainBox.show() 59 | 60 | self.nf.item_simple_push(staticImage) 61 | 62 | self.resize_object_add(mainBox) 63 | 64 | def buttonPressed(self, btn, ourObject): 65 | self.nf.item_simple_push(ourObject) 66 | 67 | if __name__ == "__main__": 68 | elm.init() 69 | GUI = MainWindow() 70 | GUI.show() 71 | elm.run() 72 | elm.shutdown() 73 | 74 | -------------------------------------------------------------------------------- /tut5-naviframe/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut5-naviframe/images/logo.png -------------------------------------------------------------------------------- /tut5-naviframe/screenshots/example7-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut5-naviframe/screenshots/example7-2.png -------------------------------------------------------------------------------- /tut5-naviframe/screenshots/example7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut5-naviframe/screenshots/example7.png -------------------------------------------------------------------------------- /tut6-elmextensions/aboutvars.py: -------------------------------------------------------------------------------- 1 | AUTHORS = """ 2 |
3 | 4 | Jeff Hoogland (Jef91)
5 | Contact

6 | 7 | """ 8 | 9 | LICENSE = """ 10 | 11 | 12 | GNU GENERAL PUBLIC LICENSE
13 | Version 3, 29 June 2007

14 |
15 | 16 | This program is free software: you can redistribute it and/or modify 17 | it under the terms of the GNU General Public License as published by 18 | the Free Software Foundation, either version 3 of the License, or 19 | (at your option) any later version.

20 | 21 | This program is distributed in the hope that it will be useful, 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 | GNU General Public License for more details.

25 | 26 | You should have received a copy of the GNU General Public License 27 | along with this program. If not, see
28 | http://www.gnu.org/licenses/ 29 | 30 | """ 31 | 32 | INFO = """ 33 | 34 | Elementary Python Extensions are awesome!
35 |
36 |
37 | 38 | """ 39 | -------------------------------------------------------------------------------- /tut6-elmextensions/ex8-elmex.py: -------------------------------------------------------------------------------- 1 | import efl.elementary as elm 2 | from efl.elementary.window import StandardWindow 3 | from efl.elementary.box import Box 4 | 5 | from elmextensions import StandardButton 6 | from elmextensions import StandardPopup 7 | from elmextensions import AboutWindow 8 | 9 | from aboutvars import * 10 | 11 | from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL 12 | EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 13 | EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0 14 | FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL 15 | 16 | class MainWindow(StandardWindow): 17 | def __init__(self): 18 | StandardWindow.__init__(self, "ex8", "ElmEx - Button and Popup", size=(300, 200)) 19 | self.callback_delete_request_add(lambda o: elm.exit()) 20 | 21 | ourButton = StandardButton(self, "Show Popup", "start-here", self.buttonPressed) 22 | ourButton.size_hint_weight = EXPAND_HORIZ 23 | ourButton.size_hint_align = FILL_BOTH 24 | ourButton.show() 25 | 26 | ourButton2 = StandardButton(self, "Show About", "dialog-information", self.button2Pressed) 27 | ourButton2.size_hint_weight = EXPAND_HORIZ 28 | ourButton2.size_hint_align = FILL_BOTH 29 | ourButton2.show() 30 | 31 | mainBox = Box(self) 32 | mainBox.size_hint_weight = EXPAND_BOTH 33 | mainBox.size_hint_align = FILL_BOTH 34 | mainBox.pack_end(ourButton) 35 | mainBox.pack_end(ourButton2) 36 | mainBox.show() 37 | 38 | self.resize_object_add(mainBox) 39 | 40 | def buttonPressed(self, btn): 41 | ourPopup = StandardPopup(self, "Press OK to close this message.", "ok") 42 | ourPopup.show() 43 | 44 | def button2Pressed(self, btn): 45 | AboutWindow(self, title="About Window", standardicon="dialog-information", \ 46 | version="1.0", authors=AUTHORS, \ 47 | licen=LICENSE, webaddress="https://github.com/JeffHoogland/python-elm-extensions", \ 48 | info=INFO) 49 | 50 | if __name__ == "__main__": 51 | elm.init() 52 | GUI = MainWindow() 53 | GUI.show() 54 | elm.run() 55 | elm.shutdown() 56 | 57 | -------------------------------------------------------------------------------- /tut6-elmextensions/screenshots/example8-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut6-elmextensions/screenshots/example8-2.png -------------------------------------------------------------------------------- /tut6-elmextensions/screenshots/example8-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut6-elmextensions/screenshots/example8-3.png -------------------------------------------------------------------------------- /tut6-elmextensions/screenshots/example8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut6-elmextensions/screenshots/example8.png -------------------------------------------------------------------------------- /tut7-lists/ex10-searchablelist.py: -------------------------------------------------------------------------------- 1 | import efl.elementary as elm 2 | from efl.elementary.window import StandardWindow 3 | 4 | from elmextensions import SearchableList 5 | from elmextensions import StandardPopup 6 | 7 | from listitems import ListItems 8 | 9 | from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL 10 | EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 11 | EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0 12 | FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL 13 | 14 | class MainWindow(StandardWindow): 15 | def __init__(self): 16 | StandardWindow.__init__(self, "ex10", "Searchable List", size=(300, 200)) 17 | self.callback_delete_request_add(lambda o: elm.exit()) 18 | 19 | searchList = SearchableList(self) 20 | searchList.size_hint_weight = EXPAND_BOTH 21 | searchList.ourList.callback_activated_add(self.listItemSelected) 22 | 23 | ListItems.sort() 24 | 25 | for it in ListItems: 26 | searchList.item_append(it) 27 | 28 | searchList.show() 29 | 30 | self.resize_object_add(searchList) 31 | 32 | def listItemSelected(self, ourList, ourItem): 33 | ourPopup = StandardPopup(self, "You selected %s"%ourItem.text, "ok") 34 | ourPopup.show() 35 | 36 | if __name__ == "__main__": 37 | elm.init() 38 | GUI = MainWindow() 39 | GUI.show() 40 | elm.run() 41 | elm.shutdown() 42 | 43 | -------------------------------------------------------------------------------- /tut7-lists/ex9-list.py: -------------------------------------------------------------------------------- 1 | import efl.elementary as elm 2 | from efl.elementary.window import StandardWindow 3 | from efl.elementary.list import List 4 | 5 | from elmextensions import StandardPopup 6 | 7 | from listitems import ListItems 8 | 9 | from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL 10 | EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 11 | EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0 12 | FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL 13 | 14 | class MainWindow(StandardWindow): 15 | def __init__(self): 16 | StandardWindow.__init__(self, "ex9", "List", size=(300, 200)) 17 | self.callback_delete_request_add(lambda o: elm.exit()) 18 | 19 | ourList = List(self) 20 | ourList.size_hint_weight = EXPAND_BOTH 21 | ourList.callback_activated_add(self.listItemSelected) 22 | 23 | ListItems.sort() 24 | 25 | for it in ListItems: 26 | ourList.item_append(it) 27 | 28 | ourList.go() 29 | ourList.show() 30 | 31 | self.resize_object_add(ourList) 32 | 33 | def listItemSelected(self, ourList, ourItem): 34 | ourPopup = StandardPopup(self, "You selected %s"%ourItem.text, "ok") 35 | ourPopup.show() 36 | 37 | if __name__ == "__main__": 38 | elm.init() 39 | GUI = MainWindow() 40 | GUI.show() 41 | elm.run() 42 | elm.shutdown() 43 | 44 | -------------------------------------------------------------------------------- /tut7-lists/listitems.py: -------------------------------------------------------------------------------- 1 | ListItems = ["Apples", 2 | "Bananas", 3 | "Cookies", 4 | "Fruit Loops", 5 | "Milk", 6 | "Apple Juice", 7 | "BBQ Sauce", 8 | "Nesquik", 9 | "Trail Mix", 10 | "Chips", 11 | "Crackers", 12 | "Cheese", 13 | "Peanutbutter", 14 | "Jelly", 15 | "Ham", 16 | "Turkey", 17 | "Potatos", 18 | "Stuffing", 19 | "Tomato Sauce", 20 | "Pineapple", 21 | "Hot Dog Chili Sauce", 22 | "Stewed Tomatoes", 23 | "Creamed Corn", 24 | "Cream of Mushroom Soup", 25 | "Peaches", 26 | "Chilies and Tomatoes", 27 | "Cream of Chicken Soup", 28 | "Cherry Pie Filling", 29 | "Canned Beans (various)", 30 | "Cream of Tomato Soup", 31 | "Apple Pie Filling", 32 | "Canned Peas", 33 | "Green Beans" 34 | ] 35 | -------------------------------------------------------------------------------- /tut7-lists/screenshots/example10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut7-lists/screenshots/example10.png -------------------------------------------------------------------------------- /tut7-lists/screenshots/example9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut7-lists/screenshots/example9.png -------------------------------------------------------------------------------- /tut8-genlist/ex11-genlist.py: -------------------------------------------------------------------------------- 1 | import efl.elementary as elm 2 | from efl.elementary.window import StandardWindow 3 | from efl.elementary.genlist import Genlist, GenlistItem, GenlistItemClass 4 | 5 | from elmextensions import StandardPopup 6 | 7 | from listitems import ListItems 8 | 9 | from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL 10 | EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 11 | EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0 12 | FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL 13 | 14 | class GLIC(GenlistItemClass): 15 | def __init__(self): 16 | GenlistItemClass.__init__(self, item_style="default") 17 | 18 | def text_get(self, gl, part, data): 19 | return data["itemName"] 20 | 21 | class MainWindow(StandardWindow): 22 | def __init__(self): 23 | StandardWindow.__init__(self, "ex11", "Genlist List", size=(300, 200)) 24 | self.callback_delete_request_add(lambda o: elm.exit()) 25 | 26 | ourList = Genlist(self) 27 | ourList.size_hint_weight = EXPAND_BOTH 28 | ourList.callback_activated_add(self.listItemSelected) 29 | 30 | ListItems.sort() 31 | 32 | for it in ListItems: 33 | li = GenlistItem(item_data={"itemName":it}, item_class=GLIC()) 34 | li.append_to(ourList) 35 | 36 | ourList.show() 37 | 38 | self.resize_object_add(ourList) 39 | 40 | def listItemSelected(self, ourList, ourItem): 41 | ourPopup = StandardPopup(self, "You selected %s"%ourItem.data["itemName"], "ok") 42 | ourPopup.show() 43 | 44 | if __name__ == "__main__": 45 | elm.init() 46 | GUI = MainWindow() 47 | GUI.show() 48 | elm.run() 49 | elm.shutdown() 50 | 51 | -------------------------------------------------------------------------------- /tut8-genlist/listitems.py: -------------------------------------------------------------------------------- 1 | ListItems = ["Apples", 2 | "Bananas", 3 | "Cookies", 4 | "Fruit Loops", 5 | "Milk", 6 | "Apple Juice", 7 | "BBQ Sauce", 8 | "Nesquik", 9 | "Trail Mix", 10 | "Chips", 11 | "Crackers", 12 | "Cheese", 13 | "Peanutbutter", 14 | "Jelly", 15 | "Ham", 16 | "Turkey", 17 | "Potatos", 18 | "Stuffing", 19 | "Tomato Sauce", 20 | "Pineapple", 21 | "Hot Dog Chili Sauce", 22 | "Stewed Tomatoes", 23 | "Creamed Corn", 24 | "Cream of Mushroom Soup", 25 | "Peaches", 26 | "Chilies and Tomatoes", 27 | "Cream of Chicken Soup", 28 | "Cherry Pie Filling", 29 | "Canned Beans (various)", 30 | "Cream of Tomato Soup", 31 | "Apple Pie Filling", 32 | "Canned Peas", 33 | "Green Beans" 34 | ] 35 | -------------------------------------------------------------------------------- /tut9-customwidget/ex12-customwidget.py: -------------------------------------------------------------------------------- 1 | import efl.elementary as elm 2 | from efl.elementary.window import StandardWindow 3 | from efl.elementary.frame import Frame 4 | from efl.elementary.image import Image 5 | 6 | 7 | from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL 8 | EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 9 | EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0 10 | FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL 11 | 12 | class PictureFrame(Frame): 13 | def __init__(self, parent_widget, ourText=None, image=None, *args, **kwargs): 14 | Frame.__init__(self, parent_widget, *args, **kwargs) 15 | 16 | self.text = ourText 17 | 18 | self.ourImage = Image(self) 19 | self.ourImage.size_hint_weight = EXPAND_BOTH 20 | 21 | if image: 22 | self.ourImage.file_set(image) 23 | 24 | self.content_set(self.ourImage) 25 | 26 | def file_set(self, image): 27 | self.ourImage.file_set(image) 28 | 29 | class MainWindow(StandardWindow): 30 | def __init__(self): 31 | StandardWindow.__init__(self, "ex12", "Custom Widget", size=(300, 200)) 32 | self.callback_delete_request_add(lambda o: elm.exit()) 33 | 34 | ourPictureFrame = PictureFrame(self) 35 | ourPictureFrame.size_hint_weight = EXPAND_BOTH 36 | ourPictureFrame.text = "A Custom Picture Frame" 37 | ourPictureFrame.file_set("images/logo.png") 38 | ourPictureFrame.show() 39 | 40 | self.resize_object_add(ourPictureFrame) 41 | 42 | if __name__ == "__main__": 43 | elm.init() 44 | GUI = MainWindow() 45 | GUI.show() 46 | elm.run() 47 | elm.shutdown() 48 | 49 | 50 | -------------------------------------------------------------------------------- /tut9-customwidget/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut9-customwidget/images/logo.png -------------------------------------------------------------------------------- /tut9-customwidget/screenshot/example12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeffHoogland/elm-tutorials/e20b259640f545997249e99cddbf31102101d12c/tut9-customwidget/screenshot/example12.png --------------------------------------------------------------------------------