Gradio logo

New to Gradio? Start here: Getting Started

See the Release History


gradio.EventData(target, ยทยทยท)


When a subclass of EventData is added as a type hint to an argument of an event listener method, this object will be passed as that argument. It contains information about the event that triggered the listener, such the target object, and other data related to the specific event that are attributes of the subclass.

Example Usage

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(evt: gr.SelectData):  # SelectData is a subclass of EventData
    return f"You selected {evt.value} at {evt.index} from {}", None, statement), None, statement), None, statement)


Parameter Description

Block | None


The target object that triggered the event. Can be used to distinguish if multiple components are bound to the same listener.