[SOLVED] Is it possible to run system.gui.transform synchronously?

Good afternoon,

Is it possible to run system.gui.transform() synchronously? I want an animation to finish before I continue my script.

def myScript():
    ...do some stuf
    system.gui.transform(350 ms)
    ...do some other stuff

Thanks for any help.

You can pass a callback function into the transform and it will execute that once the transform is done

1 Like
button1 = event.source.parent.getComponent('someButton')
rectangle = event.source.parent.getComponent('Rectangle')

p_Duration = 	15000
p_Callback = 	NUMS.helloWorld()
p_FPS = 		60
p_Accel = 		system.gui.ACCL_CONSTANT
p_Coord = 		system.gui.COORD_DESIGNER

rectX = 		rectangle.relX
rectY = 		rectangle.relY
rectWidth = 	rectangle.relWidth
rectHeight = 	rectangle.relHeight

NUMS.transform_This(button1, rectX, rectY, rectWidth, rectHeight, 
								p_Duration,  p_Callback, p_FPS, p_Accel, p_Coord)

I have the above on the action Performed script of a button called “Button”. My function helloWorld() gets executed long before the animation finishes…

def helloWorld():
    system.gui.messageBox('hello world')

You need to pass in the function definition. At the moment you’re executing the function and passing in its return value. Set p_Callback = NUMS.helloWorld instead

2 Likes

I get the following error doing that.

NUMS.transform_This(button1, rectX, rectY, rectWidth, rectHeight, 
								p_Duration,  p_Callback = NUMS.helloWorld, p_FPS, p_Accel, p_Coord)

Below:

Parse error for event handler "actionPerformed" SyntaxError: ('non-keyword arg after keyword arg', (' ', 16, 52, '\t\t\t\t\t\t\t\t\tp_Duration, p_Callback = NUMS.helloWorld, p_FPS, p_Accel, p_Coord)\n'))

The documentation says the callback function is a pyobject but i’m not sure what syntax that means for me.

I meant set it to that above where you’ve defined all your argument variables

1 Like

Nevermind. See below code.

button1 = event.source.parent.getComponent('someButton')
rectangle = event.source.parent.getComponent('Rectangle')

p_Duration = 	15000
p_Callback = 	NUMS.helloWorld
p_FPS = 		60
p_Accel = 		system.gui.ACCL_CONSTANT
p_Coord = 		system.gui.COORD_DESIGNER

rectX = 		rectangle.relX
rectY = 		rectangle.relY
rectWidth = 	rectangle.relWidth
rectHeight = 	rectangle.relHeight

NUMS.transform_This(button1, rectX, rectY, rectWidth, rectHeight, 
								p_Duration,  p_Callback, p_FPS, p_Accel, p_Coord)
1 Like

Got it. Thanks for the help.

No worries, sorry if blunt, phone on 1% haha

1 Like