# Copyright 2009 Autodesk, Inc.  All rights reserved.
# Use of this software is subject to the terms of the Autodesk license agreement 
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
#
# Script description:
# Create a tool with a thermometer (showing min/max values)
#
# Topic: FBThermometer
#

from pyfbsdk import *
from pyfbsdk_additions import *

def PopulateLayout(mainLyt):
    x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
    y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
    w = FBAddRegionParam(0,FBAttachType.kFBAttachRight,"")
    h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")
    mainLyt.AddRegion("main","main", x, y, w, h)

    th = FBThermometer()
    th.Min = -35 # Montreal temperature in winter
    th.Max = 35 # Montreal temperature in July (sometimes:)
    th.Value = 17 # Today's temperature in Montreal

    mainLyt.SetControl("main",th)


def CreateTool():
    # Tool creation will serve as the hub for all other controls
    t = CreateUniqueTool("Thermometer Tool Example")
    t.StartSizeX = 200
    t.StartSizeY = 200
    PopulateLayout(t)
    ShowTool(t)

CreateTool()