hello , i am new to pyrevit and i am testing a small python script with rpw.
how can i make a message appears 'hello world ’ when i click on the button named generate text?
any help would be appreciated.
and here is my UI+script
the script:
# -*- coding: utf-8 -*-
import sys
import clr
clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")
clr.AddReference('Microsoft.Office.Interop.Excel')
from Autodesk.Revit.UI import *
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI.Selection import *
from Autodesk.Revit.DB import Transaction
from rpw.ui.forms import Console, FlexForm, Label, TextBox, Button, select_file, Alert
from Microsoft.Office.Interop import Excel
from pyrevit import forms
doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument
t = Transaction(doc, 'Create Sheet')
components = [
Label('Sheet Name'),
TextBox('textbox1'),
Label('Sheet Number'),
TextBox('textbox2'),
Button('select excel !'),
Button('Generate text!')
]
form = FlexForm('Create sheet', components)
form.show()
def generate_button_clicked(sender, args):
Alert("Hello there!", title="Greetings")
form.add_button('Generate text!', on_click=generate_button_clicked)