1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/gojuukaze-terminal_layout

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
README.md 1.5 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
gojuukaze Отправлено 21.10.2022 16:17 88ac424

choice

Shows a list of choices, and allows the selection of one of them.

choice.gif

usage

from terminal_layout.extensions.choice import *
from terminal_layout import *

c = Choice('Which is the Best Programming Language? (press <esc> to exit) ',
           ['Python', 'C/C++', 'Java', 'PHP', 'Go', 'JS', '...'],
           icon_style=StringStyle(fore=Fore.blue),
           selected_style=StringStyle(fore=Fore.blue))

choice = c.get_choice()
if choice:
    index, value = choice
    print(value, 'is the Best Programming Language')

There are several parameter you can set:

name default desc
title title
choices a list of choices
icon '> ' delimiter list
icon_style StringStyle(fore=Fore.green) icon style
choices_style StringStyle() choices style
selected_style StringStyle() selected style
loop True loop
default_index 0 default icon index
stop_key ['q'] stop key

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/gojuukaze-terminal_layout.git
git@api.gitlife.ru:oschina-mirror/gojuukaze-terminal_layout.git
oschina-mirror
gojuukaze-terminal_layout
gojuukaze-terminal_layout
master