Metadata-Version: 2.1
Name: menufather
Version: 1.5.0
Summary: a library for creating console-based menus (linux / windows)
Author-email: MrPythonBlog <mrpythonblog@gmail.com>
License: MIT License        
        Copyright (c) 2022 MrPythonBlog        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.                
Project-URL: Homepage, https://github.com/mrpythonblog/menufather
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.5
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: colorama
Requires-Dist: cursor
Requires-Dist: pynput

# menufather Ver 1.0
**menufather** is a simple and lightweight python library for creating console-based menus (windows / linux) . 

# INSTALLATION
it can installed using **pip** :
**Linux** : ```python3 -m pip install menufather```
or **Windows** : ``` pip install menufather```


# Creating the first menu !
![creating the first menu](.Pictures/source1.png)
at first we declare our menu items in the "items" list as strings . 
then we create a menu using ```menufather.Menu(title , items)``` function . after that , we can show our menu using ```menu.show()``` method. 
* we should make a loop in our program .
* in our while loop we should use a **sleep** (ex : 0.5s sleep)


```menu.get_selected_item()``` can be used for getting the selected item by user . it returns the index of selected item in "items" list if user has selected an item else it returns **None** 
once we get selected item by this function , the next round this function returns **None** until user selects another item so we should save the result of this function in a variable at the first of loop (```selected``` variable) .

Result : 
![result 1](.Pictures/result1.png)
# Locking and Unlocking Menu
the two methods ```menu.lock()``` and ```menu.unlock()``` , can lock or unlock the menu . when menu is locked , user can't navigate or select anything on it .

# Updating menu items
we can update an item in the menu using ```menu.updateItem(itemIndex , new)``` . ```itemIndex``` is the index of item in the "items" list that we want to update and ```new``` is the string value we want to replace .

example : ```menu.updateItem(2 , "Contact")```  . this changes item index 2 in the menu to "Contact" .

# ReCreating the menu
sometimes we want to have some items that can create a new menu when user selects that . ```menu.reCreate(new_title , new_items)``` can do this . ```new_title``` is the title of the new menu and ```new_items``` is a list that contains the items of new menu . 

example : 
![reCreate menu example](.Pictures/source2.png)
after running this source , if we select "goto menu 2" item , a new menu appears (menu 2) ...


# Auto Scrolling  
if your items are too many , don't worry ! menufather simulate a scrolling state for items :
![too many item scrolling](.Pictures/toomanyitem.gif)





‍




