File: left_column_styling.py

package info (click to toggle)
textual-autocomplete 4.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 788 kB
  • sloc: python: 1,835; makefile: 4
file content (39 lines) | stat: -rw-r--r-- 1,025 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from textual.app import App, ComposeResult
from textual.content import Content
from textual.widgets import Input

from textual_autocomplete import AutoComplete, DropdownItem


LANGUAGES = [
    DropdownItem(
        "Python",
        prefix=Content.from_markup("[$text-success on $success-muted] 🐍 "),
    ),
    DropdownItem(
        "Golang",
        prefix=Content.from_markup("[$text-primary on $primary-muted] 🔷 "),
    ),
    DropdownItem("Java", prefix=Content.from_markup("[#6a2db5 on magenta 20%] ☕ ")),
    DropdownItem(
        "Rust", prefix=Content.from_markup("[$text-accent on $accent-muted] 🦀 ")
    ),
]


class LanguagesSearchApp(App[None]):
    CSS = """
    Input {
        margin: 2 4;
    }
    """

    def compose(self) -> ComposeResult:
        input_widget = Input(placeholder="Search for a programming language...")
        yield input_widget
        yield AutoComplete(target=input_widget, candidates=LANGUAGES)


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