|
1 | | -# BetterPick |
2 | | -Modern menu selection in command prompt for command lines app! |
| 1 | +# BetterPick |
| 2 | +> Modern menu selection in command prompt for command lines app! |
| 3 | +# How to install |
| 4 | +Easily download `.py` files from `Release` tab than drag it into your Project folder. |
| 5 | + |
| 6 | +# Examples |
| 7 | +> `BetterPick` is very easy too use! |
| 8 | +## For regular use: |
| 9 | +`Pick("Your menu title goes here!",["Your selection here","Sec1","Sec2"],(True or False - Multiselect) )` |
| 10 | +**Note:** In Default, To move up or down selection use key `W,S` . Press `Enter` to submit choose. Also in multichoose , press `Spacebar` to check a selection (To change these key , look for "Change key-binding" in Advance use below) |
| 11 | + |
| 12 | +Code: |
| 13 | +``` |
| 14 | +from BetterPick import Pick |
| 15 | +# For single choose |
| 16 | +# print(Pick("Your menu title goes here!",["Your selection here","Sec1","Sec2"],False)) |
| 17 | +# For multiselect |
| 18 | +# print(Pick("Your menu title goes here!",["Your selection here","Sec1","Sec2"],True)) |
| 19 | +``` |
| 20 | + |
| 21 | +### Output: |
| 22 | ++ Single-Choose (Multiselect = False) |
| 23 | + |
| 24 | ++ Multiselect |
| 25 | + |
| 26 | + |
| 27 | +## For advance-use |
| 28 | ++ Set highlight color |
| 29 | +``` |
| 30 | +from BetterPick import Pick |
| 31 | +from colorama import Fore |
| 32 | +print(Pick("Programming Languages",["Python","Java","C++"],highlight_color=Fore.BLUE)) |
| 33 | +# Set highlight color to blue |
| 34 | +``` |
| 35 | +> BetterPick's Highlight use [`Colorama`](https://pypi.org/project/colorama/) (Really Good Library). |
| 36 | ++ Output |
| 37 | + |
| 38 | +------ |
| 39 | ++ Change indicator |
| 40 | +``` |
| 41 | +import BetterPick |
| 42 | +from BetterPick import Pick |
| 43 | +BetterPick.INDICATOR = "*" |
| 44 | +# Set INDICATOR from ">" to "*" |
| 45 | +print(Pick("Programming Languages",["Python","Java","C++"])) |
| 46 | +``` |
| 47 | ++ Output: |
| 48 | + |
| 49 | +--- |
| 50 | ++ Change Key-binding |
| 51 | +``` |
| 52 | +from BetterPick import Pick |
| 53 | +Key = { |
| 54 | + "UP":"up arrow", # Change UP key from "W" to Arrow-Up |
| 55 | + "DOWN":"down arrow", # Change DOWN key from "S" to Arrow-Down |
| 56 | + "SUBMIT":"enter", |
| 57 | + "MULTISELECT_CHOOSE":"space" |
| 58 | +} |
| 59 | +print(Pick("Programming Languages",["Python","Java","C++"],key=Key)) |
| 60 | +``` |
| 61 | +--- |
| 62 | +**Fun Fact:** The menu title argument can be `String` or `Function`! |
0 commit comments