Package: pyemenu
Python - PyeMenu Version 1.0.2PyeMenu is a simple and really easy kit for developing Text User Interface apps in Python. It can be used to develop minimalist apps that run in terminal emulator.NewsPyeMenu has a lot of new features, starting by it has color now, it is possible to set foreground and background color to text, titles and widgets, there is a special class call colors to get a lot of colors by name taken from this pagethis.PyeMenu Version 1.0.1 now includes two principal elements, there are widgets and components.Widgets and ComponentsPyeMenu has two main elements group, it has components and widgets.Components: The components are elements used inside the widgets to give color to the text or to the background, depending on the widget that you use it is advisable to use a type of component or another, there are 5 types available, the Text, Title, Checkbox, Entry and Button, these are used depending on the widgets but for general uses you can use the Text class to give color to your texts and to the background.Widgets: Widgets are used to create a new window or menu where you can gather information, right now there are three possibilities, the Menu, the Checkboxlist and the Form.Menu : For select just one option from a list, return a text with the answerCheckboxlist : For select one or multiselect options from a list, return a list with the answersForm : For get information from user, it return a dictionary with answersMoere information on the WikiInstallationSimply installing it viapip:pipinstallpyemenuor installing manually as follow:For manually installing this module you can download this repo as .zip file and unzip where You need itAfter unzipingDon´t forget to install requierements.txt via pip install as followpipinstall-rrequirements.txtRequiermentsThis package uses python modulereadcharin their last version, currently in version 4.0.5.Copyright (c) 2014-2022 Miguel Ángel GarcíaExamplesIt is better to understand the components and widgets by checking an example.the following example shows how to make a Menu in a simple way, the Menu class is used for single answer questions among a list of options. The options can be of the Text class or of the text typestr, if the Text class is used it is possible to specify individually a text color, and a background color with the parameters fg and bg. The colors must be a text string with the hexadecimal format that is usually used in web development with html or using the Colors class you can search a color by its name, the references of the color and its name are inthis page.frompyemenuimportColorsfrompyemenuimportText,Title,Menudefmain():# Foreground and Background Colors using Colors Classforeground=Colors.BlackOlivebackground=Colors.GhostWhite# Options as a Text() type object# It is possible to use just a strlanguage1=Text('Python')language2=Text('JavaScript')language3=Text('Java')language4=Text('C++')language5=Text('C#')language6=Text('Swift')language7=Text('Go')language8=Text('Kotlin')# Options must be pass as a listoptions=[language1,language2,language3,language4,language5,language6,language7,language8]# The title could be pass a str or a Titletitle=Title('What is your favorite?',fg=Colors.DarkBlue,bold=True)# The same by the cursor you want to usecursor=Text('>>',fg=Colors.DarkBlue)# it is possible to create a Menu just passing the options to be choosenmenu=Menu(options,title=title,cursor=cursor,fg=foreground,bg=background)# The method print is used to show the menu on terminalmenu.print(wrap=3,highlight=True,title_align='center',title_decorator='*',title_padding_bottom=True,padding_bottom=True,padding_up=True)# Widgets has a attribute call answer to get data input for the userprint(f"\nThe selected value is:{menu.answer}")if__name__=='__main__':main()if you use this example your output would be something like this:The next code show an example for creating a checkboxlist menu for selecting multiples options from a listfrompyemenuimportColors,Title,Text,Checkboxlistdefmain():foreground=Colors.IndianRedbackground=Colors.LightGoldenrodYellowdog=Text('My Cool Dog',fg=Colors.DarkBlue,bg=Colors.Gold)options=['French Poodle','Chihuaha','Dalmata','Golden Retriever','Labrador','German Sheppard','Akita','Galgo',dog]title=Title('What is your favorite/s dog/s?',fg=Colors.SeaGreen,italic=True)cursor=Text('➤',blink=True,fg=Colors.Navy)question=Checkboxlist(options,multiselect=True,title=title,cursor=cursor,fg=foreground,bg=background)question.print(wrap=3,highlight=True,fg_hl=Colors.black,bg_hl=Colors.SkyBlue,title_padding_bottom=True,title_padding_up=True)ifquestion.answer==None:print(f"\nDo you really like dogs? ")eliflen(question.answer)==1:print(f"\nMy Favorite Dog is{question.answer}")else:print(f"\nMy Favorites Dog are{question.answer}")if__name__=='__main__':main()One of the new features of PyeMenu is the possibility to create a Form for get survey information or whatever you
want from the users. So, this example show that it is possible to print a logo or your app above the menu.frompyemenuimportColors,Title,Text,Form,Entry,Buttonlogo=r"""____        _   _     ____     __     __   U _____ u   __   __/ __"| u  U |"|u| | U |  _"\ u  \ \   /"/u  \| ___"|/   \ \ / /<\___ \/    \| |\| |  \| |_) |/   \ \ / //    |  _|"      \ V /u___) |     | |_| |   |  _ <     /\ V /_,-.  | |___     U_|"|_u|____/>>   <<\___/    |_| \_\   U  \_/-(_/   |_____|      |_|)(  (__) (__) )(     //   \\_    //         <<   >>  .-,//|(_(__)          (__)   (__)  (__)  (__)       (__) (__)  \_) (__)"""Logo=Text(logo,fg=Colors.Azure,bg=Colors.Navy)defmain():foreground=Colors.BlackOlivebackground=Colors.LightCyanplaceholder=Colors.LightBluename=Text('Name')last_name=Text('Last')age=Entry('Age',validation='int')email=Entry('Email',validation='email')password=Entry('Password',validation='password')data=[name,last_name,age,email,password]title=Title('Creating a New User',italic=True,bold=True)cursor=Text('~>')form=Form(data,title=title,cursor=cursor,fg=foreground,bg=background,placeholder_bg=placeholder,)form.print(wrap=2,highlight=True,title_align='center',logo=Logo)print(f"Your Answers are:{form.answer}")if__name__=='__main__':main()This Form class allows a lot of type of inputs from users even a custom type specifing a custom validation function from the user, for more information visit the Wiki.You can get something like thisWikiyou can view the wiki to understand more about the use of this package. It is really easy and simple for using it.
for more information get a lookhereOS SupportRight now it only been tested on Windows Os and Linux Os, some terminals emulators are not allow to show all text effects as colors, blink, an so on.LICENSEPyeMenu is using a MIT licenseCopyright (c) 2014-2023 Freire Alexander Palomino Palma