Python Form True or False output?

hi all,
python/ form question, just want a return value of “False” if form was cancelled and “True” if user press Ok/ Yes? would that be possible? Thanks in advance.

import clr
import msvcrt

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

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

buttons = TaskDialogCommonButtons.No| TaskDialogCommonButtons.Yes
result = TaskDialogResult.Ok
TaskDialog.Show('Revit',"Confirm?",buttons)

Hi @interactiverendering,

You can use this example from RevitAPIDocs as inspiration:

http://www.revitapidocs.com/code/#Python_CreateTaskDialog-py

cool!. Thanks @MartinSpence

There’s another one here:

It’s in C# though, but nice with the images so you can see what the calls are doing :-).

Glad to be able to help :slight_smile: