I've restarted my tutorial series on my blog about creating Elementary applications using Python.
Index Page -> http://jeffhoogland..../elm-tutorials/
Jump to content
Posted 24 February 2015 - 09:19 PM
Hey it's great that you wrote this, it will help people find Python-EFL and I'm happy about that. Simple and clear, expanding knowledge & skill base slowly. Well written.
Here's some issues I noticed, and corrections, please do tell if I didn't explain them well enough.
from efl.evas import EVAS_HINT_EXPAND EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
When you assign the “weight” property of a widget to our “EXPAND_BOTH” value that widget will fill the space that is available in your window.
The weight size hint will make the object use an area in a container with weighted value, for example when you have two objects in a horizontal box with size_hint_weight=(0.6, EVAS_HINT_EXPAND) and size_hint_weight=(0.4, EVAS_HINT_EXPAND) it will do a 60%:40% split horizontally. EVAS_HINT_EXPAND is shorthand for 1.0, which will weigh the objects equally.
Align size hint will align within the area assigned to the object, 0.0 is left/top, 0.5 is center, 1.0 is right/bottom. If the assigned area is the same size as the space that the object uses, it won't obviously align anywhere at all. EVAS_HINT_FILL is shorthand for the special value -1.0 which makes the object fill its assigned area entirely.
class MainWindow(StandardWindow): def __init__(self): StandardWindow.__init__(self, "ex1", "Hello Elementary", size=(300, 200)) self.callback_delete_request_add(lambda o: elm.exit())
Our third line inherits all of the StandardWindow properties to our MainWindow class.
The class definition header on the first line tells Python to pick up the class attributes from the parent class, the third line initializes the parent object instance.
The first argument for StandardWindow is the window name and the second argument is the visible title for the window. We also pass an optional size argument when creating our window that defines the starting width and height dimensions.
Maybe explain here shortly that you can use any property as keyword arg name, and the value is assigned to that property?
The last line of our MainWindow class adds the Label we have created to the window:
This is not true. The object gets added to the window when you initialize it, then you need to set its size and position. What we do here is binding the objects size and position to the windows area, whenever you resize the window it will also resize the label object!
The fifth line starts our Elementary mainloop. This is what keeps your application running until the exit() function is called. Without calling this, the Elementary window you have created will never run.
Explain this better? Maybe in a later example? The main loop processes events, signals, etc. and allow the canvas to render, when it's not busy it will enter an idle state (ie. sleep, saving energy).
Posted 24 February 2015 - 09:30 PM
A lot of that is good additional detail. I kept a lot of my language intentionally basic to try and not overwhelm the people reading. Basic is best when getting started with something new.
I think weight/hints are complex enough that they can likely warrant their own piece with a few examples so I didn't want to really get into everything they could do here.
Posted 24 February 2015 - 09:39 PM
The object that you pass with resize_object_add will also control the minimum and maximum size of your window.
Posted 24 February 2015 - 09:42 PM
Yes most of what I've written here you can explain in later examples. It's important though that your simple explanations convey the right general ideas about the concepts.
Posted 24 April 2015 - 08:23 PM
Damn I better get my bodhi box before Jeff posts the next tutorial elive has video tutorials but I prefer this way, I can get to them without hogging resources
Posted 25 April 2015 - 06:41 PM
I'm learning Ruby now, did some Python programming years back. I saw there is a Ruby bindings project for EFL.
Posted 30 April 2015 - 09:28 PM
My Python skills are a bit rusty.
The week after next I have three weeks time off. I will check the tutorials.
Posted 17 May 2015 - 07:04 PM
Completed the first tutorial Hello Elementary ...
In the second example the ident of the
def buttonPressed(self, btn):
is one space off.
The tutorial is crystal clear, easy to follow, great!
Tip for Eclipse users:
Works fine with the Eclipse 3.8 version from the repository.
Posted 23 May 2015 - 09:03 AM
Finished the second tutorial.
Expirimented with weights, something to get used to.
It works in a similar way as with Java for Android to divide the controls on the application window.
Posted 24 May 2015 - 08:48 AM
A tutorial on how to use multiple py files or how to create a package to distribute would be nice .
Posted 24 May 2015 - 01:10 PM
Creating a simple Debian package is on my list of tutorials to write, that is unrelated to pyefl tutorials though.
I'm unsure what you mean about multiple py files. There is nothing special about pyefl that needs extra tutorials about splitting things into multiple files.
Posted 24 May 2015 - 03:35 PM
Ok, just the same as plain python.
I finished all tutorials.
In the last example it is not clear what fileName does, it is set by fileName, fileExtension = os.path.splitext(selectedFile)
but I can't see how it is assigned to ourImage.
In Eclipse with PyDev you can simply press CTRL-SHIFT-F to format the code.
The idents of the example code messes up copy and pasting the code from the webpage.
0 members, 0 guests, 0 anonymous users