from pyfbsdk import *
from pyfbsdk_additions import *
def PopulateLayout(mainLyt):
x = FBAddRegionParam(5,FBAttachType.kFBAttachLeft,"")
y = FBAddRegionParam(5,FBAttachType.kFBAttachTop,"")
w = FBAddRegionParam(-5,FBAttachType.kFBAttachRight,"")
h = FBAddRegionParam(-5,FBAttachType.kFBAttachBottom,"")
main = VBoxLayout()
mainLyt.AddRegion("main","main", x, y, w, h)
mainLyt.SetControl("main",main)
hstripes = VBoxLayout()
box = HBoxLayout(FBAttachType.kFBAttachLeft)
names = ["from ->", "left ->", "to ->", "right ->"]
for name in names:
b = FBButton()
b.Caption = name
box.Add(b, 50)
hstripes.Add(box, 35)
box = HBoxLayout(FBAttachType.kFBAttachRight)
names = ["<- from", "<- right", "<- to", "<- left"]
for name in names:
b = FBButton()
b.Caption = name
box.Add(b, 50)
hstripes.Add(box, 35)
row = HBoxLayout(FBAttachType.kFBAttachLeft)
row.AddRelative(None)
b = FBButton()
b.Caption = "center"
row.Add(b, 50)
row.AddRelative(None)
hstripes.Add(row,35)
names = [("1/4 of width", 0.25), ("1/2 of width", 0.5), ("1/4 of width", 0.25)]
box = HBoxLayout(FBAttachType.kFBAttachLeft)
for name, ratio in names:
b = FBButton()
b.Caption = name
box.AddRelative(b, ratio)
hstripes.Add(box, 35)
main.AddRelative(hstripes,1.0)
vstripes = HBoxLayout()
box = VBoxLayout(FBAttachType.kFBAttachTop)
names = ["from ", "top", "to", "bottom"]
for name in names:
b = FBButton()
b.Caption = name
box.Add(b, 50)
vstripes.Add(box, 70)
box = VBoxLayout(FBAttachType.kFBAttachBottom)
names = ["from", "bottom", "to", "top"]
for name in names:
b = FBButton()
b.Caption = name
box.Add(b, 50)
vstripes.Add(box, 70)
row = VBoxLayout()
row.AddRelative(None)
b = FBButton()
b.Caption = "center"
row.Add(b, 35)
row.AddRelative(None)
vstripes.Add(row,70)
names = [("1/4 of width", 0.25), ("1/2 of width", 0.5), ("1/4 of width", 0.25)]
box = VBoxLayout()
for name, ratio in names:
b = FBButton()
b.Caption = name
box.AddRelative(b, ratio)
vstripes.Add(box, 70)
main.AddRelative(vstripes,1.0)
def CreateTool():
t = CreateUniqueTool("Box Example")
PopulateLayout(t)
t.StartSizeX = 800
t.StartSizeY = 800
ShowTool(t)
CreateTool()