TTkListItem🌢️

class TTkListItem(*, text: str | TTkString = '', data: Any = None)[source]🌢️

Bases: _TTkAbstractListItem

TTkListItem:

Base class for items in a TTkListWidget.

This widget represents a single selectable item that can be highlighted, selected, and clicked. It supports custom styling for different states (default, highlighted, selected, hover, disabled).

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Normal Item        β”‚  Default state
β”‚ Highlighted Item   β”‚  Highlighted (navigation)
β”‚ Selected Item      β”‚  Selected by user
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Methods🌢️

data() Any[source]🌢️

Returns the user data associated with this item.

Returns:

The custom data object

Return type:

Any

setData(data: Any) None[source]🌢️

Sets the user data associated with this item.

Parameters:

data (Any) – The custom data object to store

setText(text: str) None[source]🌢️

Sets the item’s display text.

Parameters:

text (str or TTkString) – The new text to display

text() TTkString[source]🌢️

Returns the item’s display text.

Returns:

The text displayed by this item

Return type:

TTkString

toTTkString()[source]🌢️

TTkListItem Attributes🌢️

dataChanged