Skip to content

Updating SelectionList Selected Icon (X) to an Emoji #6027

Answered by TomJGooding
lorddaren asked this question in Q&A
Discussion options

You must be logged in to vote

Here's a simple example, but using a symbol rather than emoji as it needs to change color:

from textual.app import App, ComposeResult
from textual.widgets import SelectionList
from textual.widgets._toggle_button import ToggleButton

ToggleButton.BUTTON_INNER = "♥"


class ExampleApp(App[None]):
    def compose(self) -> ComposeResult:
        yield SelectionList[int](*((f"Selection {n}", n) for n in range(10)))


if __name__ == "__main__":
    app = ExampleApp()
    app.run()

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@lorddaren
Comment options

@TomJGooding
Comment options

Answer selected by lorddaren
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants