Skip to main content

Generate interactive menus in a python script. Like yes/no question and menu action.

Project description

<h1>Create Menu like this</h1>

<pre><code>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()))
</code></pre>

<strong>render</strong>

<pre><code> a - Action a
b - Action b
3 - action 3
q - Quitter
? input : f
X - error key, (unavailable)
? input : q
_______
toy choose menu q : Quitter
</code></pre>

<h1>Yes/No questions</h1>
<pre><code>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()))
</code></pre>

<strong>render</strong>

<pre><code>
? Confirmer [o/N] : yes
x choose [yes] or [no]
? Confirmer [o/N] : oui
_____
bool: True. choix Oui
</code></pre>

<p>
<img src="http://doc.thivolle-cazat.fr/public/askcli/logo-50.png" alt="AskCli_img"><br>
<a href="https://github.com/thivolle-cazat-cedric/py-askcli.git">github project</a>
</p>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

askcli-1.0.4.tar.gz (6.8 kB view details)

Uploaded Source

File details

Details for the file askcli-1.0.4.tar.gz.

File metadata

  • Download URL: askcli-1.0.4.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for askcli-1.0.4.tar.gz
Algorithm Hash digest
SHA256 2186371a9151f4bd229f8789f648a0bc6939b05681c42a44387b4aff4695a0cc
MD5 25be66c0e598ebc84841d9ef3a8fd0ca
BLAKE2b-256 04d18ece7e3596f5984fb0e9f43be1151a339cead4576e20ecc504fb010af423

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page