Skip to content

ScadeBlock/BetterPick

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

BetterPick

Modern menu selection in command prompt for command lines app!

How to install

Easily download .py files from Release tab than drag it into your Project folder.

  • Install Library

BetterPick use Colorama and Keyboard
Install with pip install colorama keyboard

Compatibility

Support: Python 3.x & Windows (Linux seems supported too but I haven't tested yet)

Examples

BetterPick is very easy too use!

For regular use:

Pick("Your menu title goes here!",["Your selection here","Sec1","Sec2"],(True or False - Multiselect) )
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)

Code:

from BetterPick import Pick
# For single choose
# print(Pick("Your menu title goes here!",["Your selection here","Sec1","Sec2"],False))
# For multiselect
# print(Pick("Your menu title goes here!",["Your selection here","Sec1","Sec2"],True))

Output:

  • Single-Choose (Multiselect = False)
    image
  • Multiselect
    image

For advance-use

Set highlight color

from BetterPick import Pick
from colorama import Fore
print(Pick("Programming Languages",["Python","Java","C++"],highlight_color=Fore.BLUE))
# Set highlight color to blue

BetterPick's Highlight use Colorama (Really Good Library).

  • Output
    image

Change indicator

import BetterPick
from BetterPick import Pick
BetterPick.INDICATOR = "*"
# Set INDICATOR from ">" to "*"
print(Pick("Programming Languages",["Python","Java","C++"]))
  • Output:
    image

Fun Fact: You can add color to BetterPick's Indicator too(Only recommend for v1.1a and above & I recommend using Colorama for colors). For example :

import BetterPick
from BetterPick import Pick
from colorama import Fore,Style

BetterPick.COLOR_INDICATOR = f"{Fore.RED}*{Style.RESET_ALL}" # Indicator WITH color
BetterPick.INDICATOR = "*" # Indicator WITHOUT color
print(Pick("Programming Languages",["Python","Java","C++"]))

Change checkbox in multiselect mode(For Betterpick v1.1a and above)

import BetterPick
from BetterPick import Pick
BetterPick.MULTISELECT_CHECK = "[x]"
BetterPick.MULTISELECT_UNCHECK = "[ ]"
print(Pick("Programming Languages",["Python","Java","C++"],multiselect=True))

image

Fun Fact: You can set Select box with colors too!


Pop-up animation (v1.1a or above)

import BetterPick
from BetterPick import Pick
from colorama import Fore,Style

print(Pick("Programming Languages",["Python","Java","C++"],popup_animation=True))
Without Pop-up animation With Pop-up animation
image image

Change Key-binding

from BetterPick import Pick
Key = {
    "UP":"up arrow", # Change UP key from "W" to Arrow-Up
    "DOWN":"down arrow", # Change DOWN key from "S" to Arrow-Down
    "SUBMIT":"enter",
    "MULTISELECT_CHOOSE":"space"
} 
print(Pick("Programming Languages",["Python","Java","C++"],key=Key))

Fun Fact: The menu title argument can be String or Function!

(C) 2024 - Made By ScadeBlock

About

Modern menu selection in command prompt for command lines app!

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages