python交互式菜单_askcli-在python脚本中生成交互式菜单。比如是/否问题和菜单操作。-THIVOLLE-CAZAT cedric...

作者:THIVOLLE-CAZAT cedric

### 作者邮箱:UNKNOWN

### 首页:https://github.com/thivolle-cazat-cedric/py-askcli/tree/1.0.0/askcli

### 文档:None

### 下载链接 UNKNOWN

Create Menu like this

from askcli import Menu, Item

items = list()

# create items list

items = [Item('a', 'Action A'), Item('b', 'Action B'), 'action 3', Item('q', 'Quitter')]

m = Menu(items)

# print and wait keypress

m.launch()

print('_______')

print("you choose {0} : {1}".format(m.choose, m.get_choosen_text()))

render

a - Action a

b - Action b

3 - action 3

q - Quitter

? input : f

X - error key, (unavailable)

? input : q

_______

toy choose menu q : Quitter

Yes/No questions

from askcli.ask_bool import AskBool

a = AskBool('valid',t_text="Yes",f_text="No",required=True)

res = a.launch(err_mess="choose [yes] or [no]")

print('_____')

print("bool: {0}. choice {1}".format(res, a.get_text()))

render

? Confirmer [o/N] : yes

x choose [yes] or [no]

? Confirmer [o/N] : oui

_____

bool: True. choix Oui

Copy from pypi.org

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值