How to take user input using PyRevit?

884 views Asked by At

How would I take user input at various points while running a PyRevit script? I know that input('') doesn't work. I am wanting the user to input integers to perform a calculation.

2

There are 2 answers

1
Jeremy Tammik On BEST ANSWER

Use the .NET Windows.Forms library and display a prompt for input in a modal Windows form using ShowDialog.

0
Punnerud On

There i a build in method for this. Example

from rpw.ui.forms import TextInput
value = TextInput('Title', default="3")
print(value)

More examples in the doc: https://revitpythonwrapper.readthedocs.io/en/latest/ui/forms.html