1
2
3
4
5
6
7
8
9
10
11
12from pyfbsdk import *
13from pyfbsdk_additions import *
14
15
16def PopulateLayout(mainLyt):
17
18 x = FBAddRegionParam(5,FBAttachType.kFBAttachLeft,"")
19 y = FBAddRegionParam(5,FBAttachType.kFBAttachTop,"")
20 w = FBAddRegionParam(-5,FBAttachType.kFBAttachRight,"")
21 h = FBAddRegionParam(-5,FBAttachType.kFBAttachBottom,"")
22
23 main = FBVBoxLayout()
24 mainLyt.AddRegion("main","main", x, y, w, h)
25 mainLyt.SetControl("main",main)
26
27
28
29 hstripes = FBVBoxLayout()
30
31
32 box = FBHBoxLayout(FBAttachType.kFBAttachLeft)
33 names = ["from ->", "left ->", "to ->", "right ->"]
34 for name in names:
36 b.Caption = name
37 box.Add(b, 50)
38 hstripes.Add(box, 35)
39
40
41 box = FBHBoxLayout(FBAttachType.kFBAttachRight)
42 names = ["<- from", "<- right", "<- to", "<- left"]
43 for name in names:
45 b.Caption = name
46 box.Add(b, 50)
47 hstripes.Add(box, 35)
48
49
50 row = FBHBoxLayout(FBAttachType.kFBAttachLeft)
51 row.AddRelative(None)
53 b.Caption = "center"
54 row.Add(b, 50)
55 row.AddRelative(None)
56 hstripes.Add(row,35)
57
58
59 names = [("1/4 of width", 0.25), ("1/2 of width", 0.5), ("1/4 of width", 0.25)]
60 box = FBHBoxLayout(FBAttachType.kFBAttachLeft)
61 for name, ratio in names:
63 b.Caption = name
64 box.AddRelative(b, ratio)
65 hstripes.Add(box, 35)
66
67
68
69 main.AddRelative(hstripes,1.0)
70
71 vstripes = FBHBoxLayout()
72
73
74 box = FBVBoxLayout(FBAttachType.kFBAttachTop)
75 names = ["from ", "top", "to", "bottom"]
76 for name in names:
78 b.Caption = name
79 box.Add(b, 50)
80 vstripes.Add(box, 70)
81
82
83 box = FBVBoxLayout(FBAttachType.kFBAttachBottom)
84 names = ["from", "bottom", "to", "top"]
85 for name in names:
87 b.Caption = name
88 box.Add(b, 50)
89 vstripes.Add(box, 70)
90
91
92 row = FBVBoxLayout()
93 row.AddRelative(None)
95 b.Caption = "center"
96 row.Add(b, 35)
97 row.AddRelative(None)
98 vstripes.Add(row,70)
99
100
101 names = [("1/4 of width", 0.25), ("1/2 of width", 0.5), ("1/4 of width", 0.25)]
102 box = FBVBoxLayout()
103 for name, ratio in names:
105 b.Caption = name
106 box.AddRelative(b, ratio)
107 vstripes.Add(box, 70)
108
109 main.AddRelative(vstripes,1.0)
110
111def CreateTool():
112
113 t = FBCreateUniqueTool("Box Example")
114 PopulateLayout(t)
115 t.StartSizeX = 800
116 t.StartSizeY = 800
117 ShowTool(t)
118
119
120CreateTool()