How to construct a TaskDialog?


I am wanting to construct a Taskdialog.

This seems straight forward when constructing single line commands. I’m more intrigued as a general python / class question.

I would have thought as a class I could construct a more complex TaskDialog, however I’m getting a TypeError: NoneType is not callable.

Could someone explain why this is the case ?

import clr
from Autodesk.Revit.UI import *

# Method 1 - this works
#TaskDialog.Show("Title", "Main Content")

#Method 2 - TypeError : NoneType is not callable
dialog = TaskDialog("Header")
dialog.FooterText("Footer Text")


Many thanks all



You are calling it wrong. Try this:

import clr
from Autodesk.Revit.UI import *

dialog = TaskDialog("Header")
dialog.MainInstruction = "Hello, Revit!"
dialog.MainContent = "This sample shows how to use a Revit task dialog to communicate with the user." "The command links below open additional task dialogs with more information."

dialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "View information about the Revit installation")
dialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "View information about the active document")

dialog.CommonButtons = TaskDialogCommonButtons.Close;
dialog.DefaultButton = TaskDialogResult.Close;

dialog.FooterText = "<a href=\" \"> Click here for the Revit API Developer Center</a>"


#Assign your output to the OUT variable.
OUT = dialog



Thank you Konrad