Dynamo Python - display message

Hi, In an effort to learn Python and the Revit API, I’ve created the following to display an alert message box: import clr

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk from Autodesk.Revit.DB import *
Autodesk.Revit.UI.TaskDialog.Show ("Test Title", "Test Message")
I get the following message about TaskDialog being read only:

 

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed. Traceback (most recent call last): File “”, line 7, in AttributeError: attribute ‘UI’ of ‘namespace#’ object is read-only

 

I’d appreciate some pointers on what I’m doing wrong - thanks.

1 Like

Hi Kevin,

The problem is that the TaskDialog class resides in the UI namespace. You’ll need to import the UI library before using its classes and methods:

3 Likes

Brilliant - thanks.

Hi @Dimitar_Venkov, What if I want to just send a message like “Task Done!” when my script has completed? What with the Input to the python node?

Thanks in advance.

Please tart a new thread for this.