Skip to content

ScadeBlock/BetterPick

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BetterPick πŸ’¬

Modern menu selection in command prompt for command lines app!

πŸ‘‹ How to install

  • 🧑 Option 1 (Recommend) : Pip
    • Easily run: pip install better-pick
  • Option 2 : Manual Install
    • Easily download .py files from Release tab than drag it into your Project folder.
    • Install requirements 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! πŸ–

Supereme Demo

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!


Default choice(auto choose) in MultiSelect (BetterPick 1.2 or above)

from BetterPick import Pick
print(Pick("Programming Languages",["Python","Java","C++"],multiselect=True,auto_choose=[0]))

image


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