UI/Thermometer.py

UI/Thermometer.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 a thermometer (showing min/max values)
8 #
9 # Topic: FBThermometer
10 #
11 
12 from pyfbsdk import *
13 from pyfbsdk_additions import *
14 
15 def PopulateLayout(mainLyt):
16  x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
17  y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
18  w = FBAddRegionParam(0,FBAttachType.kFBAttachRight,"")
19  h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")
20  mainLyt.AddRegion("main","main", x, y, w, h)
21 
22  th = FBThermometer()
23  th.Min = -35 # Montreal temperature in winter
24  th.Max = 35 # Montreal temperature in July (sometimes:)
25  th.Value = 17 # Today's temperature in Montreal
26 
27  mainLyt.SetControl("main",th)
28 
29 
30 def CreateTool():
31  # Tool creation will serve as the hub for all other controls
32  t = FBCreateUniqueTool("Thermometer Tool Example")
33  t.StartSizeX = 200
34  t.StartSizeY = 200
35  PopulateLayout(t)
36  ShowTool(t)
37 
38 CreateTool()