Tutorial on Layout

In the wiki comments a user had difficulty placing a text box and an image. Here's an intro.

Let's start with Hello World (which is provided with DS and shows an image and some text.
Initially the code has

lay=app.CreateLayout("linear","VCenter,FillXY");

This creates a layout where the elements are centred vertically, and the layout fills the screen top-to-bottom and left-to-right.
If we remove VCenter (and the comma) then the elements appear at the top of the screen.
Try it.
If we then want the elements to be side by side and on the left, add Horizontal and Left
Let's also drop the FillXY because we aren't putting elements in the centre of the screen.

lay=app.CreateLayout("linear","Horizontal,Left");

The text box has margins (space between elements)
0 to the left,
0.05 (5 percent of the screen) above,
0 to the right,
0 below.
Try giving it a margin of 20 percent of the screen on the left, and no margin at the top by changing to

txt.SetMargins(0.2,0,0,0);

Or you can specify sizes in pixels, for example a margin on the left of 20 pixels

txt.SetMargins(20,0,0,0,"px");

There are many other possibilities (setting widths and heights, padding, layouts within layouts).
See the documentation of Layouts and Controls.