Python Reference Guide
 
Loading...
Searching...
No Matches
UI\Label.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# Create a tool with labels and set all their properties.
8#
9# Topic: FBLabel, FBTextJustify, FBTextStyle
10#
11
12from pyfbsdk import *
13from pyfbsdk_additions import *
14
15def PopulateLayout(mainLyt):
16 lyt = FBVBoxLayout()
17 x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
18 y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
19 w = FBAddRegionParam(50,FBAttachType.kFBAttachNone,"")
20 h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")
21 mainLyt.AddRegion("main","main", x, y, w, h)
22 mainLyt.SetControl("main",lyt);
23
24 l = FBLabel()
25 l.Caption = "This is a label!!!!"
26 l.Style = FBTextStyle.kFBTextStyleBold
27 l.WordWrap = True
28 lyt.Add(l, 25)
29
30 #FBTextJustify.kFBTextJustifyLeft
31 #FBTextJustify.kFBTextJustifyRight
32 #FBTextJustify.kFBTextJustifyCenter
33
34 #FBTextStyle.kFBTextStyleNone
35 #FBTextStyle.kFBTextStyleBold
36 #FBTextStyle.kFBTextStyleItalic
37 #FBTextStyle.kFBTextStyleUnderlined
38
39 l = FBLabel()
40 l.Caption = "left"
41 l.Style = FBTextStyle.kFBTextStyleItalic
42 l.Justify = FBTextJustify.kFBTextJustifyLeft
43 lyt.Add(l, 25)
44
45 l = FBLabel()
46 l.Caption = "center"
47 l.Style = FBTextStyle.kFBTextStyleUnderlined
48 l.Justify = FBTextJustify.kFBTextJustifyCenter
49 lyt.Add(l, 25)
50
51 l = FBLabel()
52 l.Caption = "right"
53 l.Justify = FBTextJustify.kFBTextJustifyRight
54 lyt.Add(l, 25)
55
56
57def CreateTool():
58 # Tool creation will serve as the hub for all other controls
59 t = FBCreateUniqueTool("Label Example")
60 t.StartSizeX = 400
61 t.StartSizeY = 400
62 PopulateLayout(t)
63 ShowTool(t)
64
65
66CreateTool()
Text label.
Definition: pyfbsdk_generated.h:9829