Python Reference Guide
 
Loading...
Searching...
No Matches
UI\CloseTool.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 that will create and close a FBPopup
8#
9# Topic: FBTool
10#
11
12from pyfbsdk import *
13from pyfbsdk_additions import *
14
15# a Popup is really a layout. It should be populated/initialized
16def CloseCallback(control, event):
17 CloseTool(globalTool)
18
19
20def PopulateLayout(mainLyt):
21 # create a button on the tool that will show the popup
22 b = FBButton()
23 b.Caption = "Close Me!"
24
25 x = FBAddRegionParam(10,FBAttachType.kFBAttachLeft,"")
26 y = FBAddRegionParam(10,FBAttachType.kFBAttachTop,"")
27 w = FBAddRegionParam(50,FBAttachType.kFBAttachNone,"")
28 h = FBAddRegionParam(25,FBAttachType.kFBAttachNone,"")
29
30 mainLyt.AddRegion("Btn","Btn", x, y, w, h)
31 mainLyt.SetControl("Btn",b)
32
33 b.OnClick.Add(CloseCallback)
34
35
36def CreateTool():
37 # Tool creation will serve as the hub for all other controls
38 global globalTool
39 globalTool = FBCreateUniqueTool("Close Tool Example")
40 globalTool.StartSizeX = 200
41 globalTool.StartSizeY = 100
42 PopulateLayout(globalTool)
43 ShowTool(globalTool)
44
45
46CreateTool()
47
Used to create and manage buttons in a user interface.
Definition: pyfbsdk_generated.h:2442