Skip to content

Commit

Permalink
Added example 2 to tutorial 1
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffHoogland committed Feb 22, 2015
1 parent 9367940 commit 0b3123b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tut1-hello-elementary/ex1-helloelementary.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import efl.elementary as elm
from efl.elementary.window import StandardWindow
from efl.elementary.label import Label
from efl.evas import EVAS_HINT_EXPAND

from efl.evas import EVAS_HINT_EXPAND
EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND

class MainWindow(StandardWindow):
Expand Down
42 changes: 42 additions & 0 deletions tut1-hello-elementary/ex2-helloelementary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import efl.elementary as elm
from efl.elementary.window import StandardWindow
from efl.elementary.label import Label
from efl.elementary.button import Button
from efl.elementary.box import Box

from efl.evas import EVAS_HINT_EXPAND
EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND

class MainWindow(StandardWindow):
def __init__(self):
StandardWindow.__init__(self, "ex2", "Hello Elementary", size=(300, 200))
self.callback_delete_request_add(lambda o: elm.exit())

ourLabel = Label(self)
ourLabel.size_hint_weight = EXPAND_BOTH
ourLabel.text = "Hello Elementary!"
ourLabel.show()

ourButton = Button(self)
ourButton.size_hint_weight = EXPAND_BOTH
ourButton.text = "Goodbye Elementary"
ourButton.callback_clicked_add(self.buttonPressed)
ourButton.show()

ourBox = Box(self)
ourBox.size_hint_weight = EXPAND_BOTH
ourBox.pack_end(ourLabel)
ourBox.pack_end(ourButton)
ourBox.show()

self.resize_object_add(ourBox)

def buttonPressed(self, btn):
elm.exit()

if __name__ == "__main__":
elm.init()
GUI = MainWindow()
GUI.show()
elm.run()
elm.shutdown()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tut1-hello-elementary/screenshots/example2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0b3123b

Please sign in to comment.