Python Yes/No Dialog Box?

Luckily, I made that Rhythm node. :wink: And it is long retired, so your version is WAAAAY old BTW.


That being said, it sounds like you want to return true or false depending on the Yes/No selection. Here is how to do that.

The python code in action:

and the actual code for copy pasta:

import clr

clr.AddReference("RevitAPIUI")
from  Autodesk.Revit.UI import *

dialogContent = "You are about to delete all Fabrication Pipework content from the model. Are you sure?"
buttons = TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.No

#assigning this to a dialog result variable allows us to check what the user selected
dialogResult = TaskDialog.Show('Delete all MEP',dialogContent,buttons)

#define a return value parameter for use as an output
returnValue = False;

#if the user clicks yes, return true to continue
if dialogResult == TaskDialogResult.Yes:
	returnValue = True
		
OUT = returnValue
9 Likes