mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
* inflect * diagram * tooltip render * tooltip property * add guard * tooltip docs * docs * tidy, fix horizontal * words, removed comment * fix screenshot render * simplify * simfplify * changelog * simplify optimize * inflect tests * Apply suggestions from code review Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com> * docstring * disable auto focus * should be fraction * optimization * snapshot update * Update tests/snapshot_tests/snapshot_apps/scroll_to_center.py Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com> --------- Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
32 lines
643 B
Python
32 lines
643 B
Python
from textual.app import App, ComposeResult
|
|
from textual.widgets import Button
|
|
|
|
TEXT = """I must not fear.
|
|
Fear is the mind-killer.
|
|
Fear is the little-death that brings total obliteration.
|
|
I will face my fear."""
|
|
|
|
|
|
class TooltipApp(App):
|
|
CSS = """
|
|
Screen {
|
|
align: center middle;
|
|
}
|
|
Tooltip {
|
|
padding: 2 4;
|
|
background: $primary;
|
|
color: auto 90%;
|
|
}
|
|
"""
|
|
|
|
def compose(self) -> ComposeResult:
|
|
yield Button("Click me", variant="success")
|
|
|
|
def on_mount(self) -> None:
|
|
self.query_one(Button).tooltip = TEXT
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app = TooltipApp()
|
|
app.run()
|