Message 1 of 3

Not applicable
01-11-2021
02:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am working on an add-in for Fusion, and want to update the image I show in the dialog, from within my InputChangedHandler. The creation of the new image can take some time, so I want to show a dummy image in the meantime. This is my code for that so far:
def notify(self, args):
eventArgs = adsk.core.InputChangedEventArgs.cast(args)
app = adsk.core.Application.get()
ui = app.userInterface
try:
# access global variables
global filePath, imgInput
if eventArgs.input.id == 'getFile':
# open a fileDialog
fileDialog = ui.createFileDialog()
fileDialog.isMultiSelectEnabled = False
fileDialog.title = "Select Image"
fileDialog.filter = 'Image Files (*.BMP;*.JPG;*.PNG)'
fileDialog.filterIndex = 0
dialogResult = fileDialog.showOpen()
if dialogResult == adsk.core.DialogResults.DialogOK:
filePath = fileDialog.filename
# make ImageCommandInput visible and set the dummy image
imgInput.isVisible = True
imgInput.imageFile = "resources/load-icon.png"
# this can take some time
extractContours()
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
The problem is, that the image is not updating before extractContours().
I would appreciate any help, thanks in advance!
Solved! Go to Solution.