Skip to main content
Event data classes provide additional information about events that triggered a listener. When added as a type hint to an event listener function parameter, the corresponding EventData object will automatically be passed.

EventData

The base event data class. Contains information about the event that triggered the listener.

Attributes

Block | None
The component object that triggered the event. Can be used to distinguish multiple components bound to the same listener.

Example

SelectData

Carries information about the .select() event.

Attributes

Block | None
The component object that triggered the event.
Any
The index of the selected item. Is a tuple if the component is two dimensional or selection is a range.
Any
The value of the selected item.
Any
The value of the entire row that the selected item belongs to, as a 1-D list. Only implemented for the Dataframe component, returns None for other components.
Any
The value of the entire column that the selected item belongs to, as a 1-D list. Only implemented for the Dataframe component, returns None for other components.
bool
True if the item was selected, False if deselected.

Example

LikeData

Carries information about the .like() event.

Attributes

Block | None
The component object that triggered the event.
int | tuple[int, int]
The index of the liked/disliked item. Is a tuple if the component is two dimensional.
Any
The value of the liked/disliked item.
bool | str
True if the item was liked, False if disliked, or string value if any other feedback.

Example

KeyUpData

Carries information about the .key_up() event.

Attributes

Block | None
The component object that triggered the event.
str
The key that was pressed.
str
The displayed value in the input textbox after the key was pressed. This may be different than the value attribute of the component itself.

DeletedFileData

Carries information about the .delete() event.

Attributes

Block | None
The component object that triggered the event.
FileData
The file that was deleted, as a FileData object.

RetryData

Carries information about the .retry() event.

Attributes

Block | None
The component object that triggered the event.
int | tuple[int, int]
The index of the user message that should be retried.
Any
The value of the user message that should be retried.

UndoData

Carries information about the .undo() event.

Attributes

Block | None
The component object that triggered the event.
int | tuple[int, int]
The index of the user message that should be undone.
Any
The value of the user message that should be undone.

EditData

Carries information about the .edit() event.

Attributes

Block | None
The component object that triggered the event.
int | tuple[int, int]
The index of the message that was edited.
Any
The previous content of the message that was edited.
Any
The new content of the message that was edited.

DownloadData

Carries information about the .download() event.

Attributes

Block | None
The component object that triggered the event.
FileData
The file that was downloaded, as a FileData object.

CopyData

Carries information about the .copy() event.

Attributes

Block | None
The component object that triggered the event.
Any
The value that was copied.