IngoMeyer441 / simple-term-menu

A Python package which creates simple interactive menus on the command line.
MIT License
492 stars 43 forks source link

Control menu-cancel character #54

Closed bhakta0007 closed 2 years ago

bhakta0007 commented 2 years ago

How can I prevent Escape key from canceling the menu.

Can this be controlled?

I use in GNU screen environment, and I use screen scroll / search up and down. Escape is what I use to come back to normal mode from selection mode.

I would like to restrict the menu cancel to "q" and "ctrl-c"

IngoMeyer441 commented 2 years ago

This is now implemented in the latest develop version. You can install it with

python3 -m pip install https://github.com/IngoMeyer441/simple-term-menu@develop

Pass quit_keys=("q", ) to the TerminalMenu constructor to only allow q and <Ctrl-c> to exit the menu.

IngoMeyer441 commented 2 years ago

The new feature is also part of the latest release v1.5.0. Feel free to reopen if the new feature does not correctly work for you.

bhakta0007 commented 2 years ago

@IngoMeyer441 thank for getting this done, I will give it a shot