Skip to main content
Version: 8.1

system.gui.transform

This function is used in Python Scripting.

Description

Sets a component's position and size at runtime. Additional arguments for the duration, framesPerSecond, and acceleration of the operation exist for animation. An optional callback argument will be executed when the transformation is complete.

note

The transformation is performed in Designer coordinate space on components that are centered or have more than two anchors.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.gui.transform(component, [newX], [newY], [newWidth], [newHeight], [duration], [callback], [framesPerSecond], [acceleration], [coordSpace])

Parameters

TypeParameterDescription
JComponentcomponentThe component to move or resize.
IntegernewXAn x-coordinate to move to, relative to the upper-left corner of the component's parent container. [optional]
IntegernewYA y-coordinate to move to, relative to the upper-left corner of the component's parent container. [optional]
IntegernewWidthA width for the component. [optional]
IntegernewHeightA height for the component. [optional]
IntegerdurationA duration over which the transformation will take place. If omitted or 0, the transform will take place immediately. [optional]
CallablecallbackFunction to be called when the transformation is complete. [optional]
IntegerframesPerSecondFrame rate argument which dictates how often the transformation updates over the given duration. The default is 60 frames per second. [optional]
IntegeraccelerationAn optional modifier to the acceleration of the transformation over the given duration. See system.gui constants for valid arguments. [optional]
IntegercoordSpaceThe coordinate space to use. When the default screen coordinates are used, the given size and position are absolute, as they appear in the Client at runtime. When Designer Coordinates are used, the given size and position are pre-runtime adjusted values, as they would appear in the Designer. See system.gui constants for valid arguments. [optional]

Returns

Animator animation - An object that contains pause(), resume(), and cancel() methods, allowing for a script to interrupt the animation. See Animator.

Scope

Vision Client

Code Examples

Example #1
# This example changes the size the a component to 100x100.
# Run this script from the component that will be changed (i.e., on the mouseEntered event).

system.gui.transform(component=event.source, newWidth=100, newHeight=100)
Example #2
# This example moves a component to coordinates 0,0 over the course of 1 second.  
# When the animation is complete, the component is moved back to its original position
# over the course of 2 seconds, slowing in speed as it approaches the end.

component = event.source.parent.getComponent('Text Field')
origX = component.x
origY = component.y

system.gui.transform(
component,
0, 0,
duration=1000,
callback=lambda: system.gui.transform(
component,
origX, origY,
duration=2000,
acceleration=system.gui.ACCL_FAST_TO_SLOW
)
)

Keywords

system gui transform, gui.transform