Python Reference Guide
 
Loading...
Searching...
No Matches
UI\TutorialBox.py
1# Copyright 2009 Autodesk, Inc. All rights reserved.
2# Use of this software is subject to the terms of the Autodesk license agreement
3# provided at the time of installation or download, or which otherwise accompanies
4# this software in either electronic or hard copy form.
5#
6# Script description:
7# Tutorial for the FBBoxLayout. This is the code used in the Python Scripting Help Dev Guide.
8#
9# Topic: FBMemo, FBVBoxLayout, FBVisualContainer
10#
11
12from pyfbsdk import *
13from pyfbsdk_additions import *
14
15t = FBCreateUniqueTool("Vertical sample")
16t.StartSizeX = 400
17t.StartSizeY = 400
18
19# Create region to hold our vbox. the vbox will fill the whole region
20x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
21y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
22w = FBAddRegionParam(0,FBAttachType.kFBAttachRight,"")
23h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")
24t.AddRegion("vbox","vbox", x, y, w, h)
25
26# create our vbox: we set the inital kFBAttachTop so controls are
27# lined from top to bottom
28vbox = FBVBoxLayout( FBAttachType.kFBAttachTop )
29t.SetControl("vbox",vbox)
30
31# create the Label
32label = FBLabel()
33label.Caption = "Here is our test label"
34# add the label and specify a fixed height of 30 pixels
35vbox.Add(label, 30)
36
37# create the container
38container = FBVisualContainer()
39
40# specify a ratio of 2
41vbox.AddRelative(container, 2.0)
42
43# create the memo
44memo = FBMemo()
45
46# specify a ratio of 1
47vbox.AddRelative(memo, 1.0)
48
49# ratio explanation
50# the ratio total is 2.0 + 1.0 = 3.0
51# the container occuppies 2.0/3.0 : hence 2/3 of the total space
52# the memo occupies 1.0/3.0 : hence 1/3 of space
53# we could have used 0.66 and 0.33 as ratio and the result would have
54# been the same
55
56
57ShowTool(t)
Text label.
Definition: pyfbsdk_generated.h:9829
Multi-line text input.
Definition: pyfbsdk_generated.h:10680
Used to create a container for a tool UI.
Definition: pyfbsdk_generated.h:21308