Update GUI via Asynchronous thread

Define a function in your fileTransfer function that you call with system.util.invokeLater.

Example:

import shutil
label = event.source.parent.getComponent("Label")
def fileTransfer():
	path = system.file.openFile()
	newPath = "F:\NewFolder"
	shutil.copy2(path, newPath)
	def func():
		label.text = "Step one done"
	system.util.invokeLater(func)
system.util.invokeAsynchronous(fileTransfer)

Functions called with invokeLater are always run on the GUI thread so this is safe.

Best,

1 Like