File: with-frame.py

package info (click to toggle)
prompt-toolkit 3.0.52-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,628 kB
  • sloc: python: 31,599; makefile: 151; sh: 6
file content (25 lines) | stat: -rwxr-xr-x 445 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
#!/usr/bin/env python
"""
Example of a frame around a prompt input.
"""

from prompt_toolkit import prompt
from prompt_toolkit.styles import Style

style = Style.from_dict(
    {
        "frame.border": "#884444",
    }
)


def example():
    """
    Style and list of (style, text) tuples.
    """
    answer = prompt("Say something > ", style=style, show_frame=True)
    print(f"You said: {answer}")


if __name__ == "__main__":
    example()