0

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.

Christian Gentry
  • 811
  • 3
  • 10
  • 15

2 Answers2

1

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

Jeremy Tammik
  • 7,333
  • 2
  • 12
  • 17
  • Tkinter or wxPython would remove the need for .NET installed. If you compile the your python-script the user also don't need Python. – Punnerud Feb 21 '19 at 07:02
0

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

Punnerud
  • 7,195
  • 2
  • 54
  • 44