Introducing Gradio Clients
WatchIntroducing Gradio Clients
WatchNew to Gradio? Start here: Getting Started
See the Release History
gradio.EventData(ยทยทยท)
.target
attribute that refers to the component that triggered the event, while subclasses of gr.EventData contains additional attributes that are different for each class. import gradio as gr
with gr.Blocks() as demo:
table = gr.Dataframe([[1, 2, 3], [4, 5, 6]])
gallery = gr.Gallery([("cat.jpg", "Cat"), ("dog.jpg", "Dog")])
textbox = gr.Textbox("Hello World!")
statement = gr.Textbox()
def on_select(value, evt: gr.EventData):
return f"The {evt.target} component was selected, and its value was {value}."
table.select(on_select, table, statement)
gallery.select(on_select, gallery, statement)
textbox.select(on_select, textbox, statement)
demo.launch()
Parameter | Description |
---|---|
target Block | None | The component object that triggered the event. Can be used to distinguish multiple components bound to the same listener. |