ANSIController


NameANSIController JSON
Version 1.1.1 PyPI version JSON
download
home_pagehttps://github.com/jo0x01/ansicontroller
SummaryBasic Python Module to control & color & style text in terminal
upload_time2023-08-29 05:28:11
maintainer
docs_urlNone
authorJoOx01
requires_python
licenseMIT
keywords cmd ansi terminal ansi_terminal ansicontrol ansicontroller asni ansicontroller ansi_escape
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ```sh

#         d8888 888b    888  .d8888b. 8888888                                              
#        d88888 8888b   888 d88P  Y88b  888                                                
#       d88P888 88888b  888 Y88b.       888                                                
#      d88P 888 888Y88b 888  "Y888b.    888                                                
#     d88P  888 888 Y88b888     "Y88b.  888                                                
#    d88P   888 888  Y88888       "888  888                                                
#   d8888888888 888   Y8888 Y88b  d88P  888                                                
#  d88P     888 888    Y888  "Y8888P" 8888888                                              
#                                                                                          
#                                                                                          
#                                                                                          
#              .d8888b.                    888                    888 888                  
#             d88P  Y88b                   888                    888 888                  
#             888    888                   888                    888 888                  
#             888         .d88b.  88888b.  888888 888d888 .d88b.  888 888  .d88b.  888d888 
#             888        d88""88b 888 "88b 888    888P"  d88""88b 888 888 d8P  Y8b 888P"   
#             888    888 888  888 888  888 888    888    888  888 888 888 88888888 888     
#             Y88b  d88P Y88..88P 888  888 Y88b.  888    Y88..88P 888 888 Y8b.     888     
#              "Y8888P"   "Y88P"  888  888  "Y888 888     "Y88P"  888 888  "Y8888  888     
#                                                                                         
```
# ANSI Controller
> Basic Python Script to control cursor postion in terminal
> and colorize any text in terminal , add any style to graphic mode in terminal

<div style="
    color: white;
    background-color: #8B0000;
    padding: 10px;
    alignment: center;
    text-align: center;
">
<b>Note</b><br>
! This Module work Depends of Terminal Type of support ANSI escape characters or not !
<hr>
if u face any issue write it
</div>
<br>

# Note:
> #### The Goal of writing this script is to make it easier to control the terminal by simply writing the name of the color or the name of the style of the text or moving the cursor by calling a function or deleting the text in the window, use it to learn how much it will make it easier for you if you are always using the command window


[![PyPi](https://img.shields.io/badge/-PyPi-blue.svg?logo=pypi&labelColor=555555&style=for-the-badge)](https://pypi.org/project/ANSIController "PyPi") [![License: license](https://img.shields.io/badge/-license-blue.svg?style=for-the-badge)](LICENSE "License")

[More Info About ANSI Escape Codes](`https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#escape`)

## Tool Snap
_______________
![Alt Text](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/tool.png)

## Features
------------------------------
`ANSI Controller` Features:
- Move Cursor Right or left or top or down or postion in terminal screen
- Colorize any text u want in terminal
- Change Style of terminal printing text , bold ,italic , etc...
- MultiProgress in same time
## Tech
------------------------------
`ANSI Controller` uses a number of open source projects to work properly:
- [keyboard] - pypi module `https://pypi.org/project/keyboard/`
- `ANSI Controller` itself is open source on GitHub.
- `More Info About ANSI Escape Codes: `https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#escape
## Installation
------------------------------

`ANSI Controller` requires [pip](https://pypi.org/) to install.
Install the dependencies and devDependencies and start the script.
### Windows
```bash
pip install --upgrade ANSIController
```
### Linux && Termux
```bash
pip3 install --upgrade ANSIController
```
# Table of colors & style
- #### if terminal not support colorize the string will just remove from string
- ### Note: Add Custom Values, to string to colorize the output
> - ### [ID Colors](https://robotmoon.com/256-colors/): `<{id}>`  from 0 to 255 , `<255>` , `<15>`

> - ### [RGB Colors](https://www.rapidtables.com/web/color/RGB_Color.html): `(red_value,green_value,blue_value)` from 0 to 255  , `(213,201,250)`
> - ### [Hex RGB](https://www.rapidtables.com/web/color/RGB_Color.html): `#FFFFFF` using hex , `#4affa1`

- #### Background: `X,x`
- #### Reset: `Z,0,reset,Reset`
- #### Colors:
    - [+] `black:`              `b,black,30`
    - [+] `red:`                `r,red,31`
    - [+] `green:`              `g,green,32`
    - [+] `yellow:`             `y,yellow,33`
    - [+] `blue:`               `l,blue,34`
    - [+] `magenta:`            `m,magenta,35`
    - [+] `cyan:`               `c,cyan,36`
    - [+] `white:`              `w,white,37`
    - [+] `default:`            `d,default,39`
    - [+] `bright black:`       `bb,bblack,90`
    - [+] `bright red:`         `br,bred,91`
    - [+] `bright green:`       `bg,bgreen,92`
    - [+] `bright yellow:`      `by,byellow,93`
    - [+] `bright blue:`        `bl,bblue,94`
    - [+] `bright magenta`      `bm,bmagenta,95`
    - [+] `bright cyan:`        `bc,bcyan,96`
    - [+] `bright white:`       `bw,bwhite,97`
- #### Styles:
    - [+] `bold:`               `B,bold,1`
    - [+] `dim:`                `D,dim,2`
    - [+] `italic:`             `I,italic,3`
    - [+] `underline:`          `U,underline,4`
    - [+] `blinking:`           `L,blinking,5`
    - [+] `reverse:`            `R,reverse,7`
    - [+] `hidden:`             `H,hidden,8`
    - [+] `strikethrough:`      `S,strikethrough,9`
- #### ProgressBar: add `%{char}%`
    - [+] `c:`                  `current progress value`
    - [+] `m:`                  `max progress value`
    - [+] `p:`                  `percent progress value`
    - [+] `b:`                  `bar progress value`
    - [+] `f:`                  `print full bar with all info`
    - [+] `e:` `Elapsed Time`
    - [+] `r:` `Remaining Time`
    - [+] `s:` `Speed`
    - [+]  `your_custom_key:`    `your_custom_value`
- #### More Control in ProgressBar:
    - [+] `txt:`                `key of string value inside`
    - [+] `mx:`                 `max value default is 100`
    - [+] `inc:`                `increamnt value defualt is 1`
    - [+] `bopen:` `bar open char default '|'`
    - [+] `bfill:` `bar filled char default '█'`
    - [+] `bafill:` `bar after filled char default ''`
    - [+] `bempty:` `bar empty char default ' '`
    - [+] `bclose:` `bar close char default ' '`
    - [+] `custom:`             `dict object with custom keys`
## Examples & Usage
____________
> Terminal Execute
### windows
```shell
python -m ANSIController
```
> OR
```shell
ansicontroller
```
### Linux && Termux
```shell
python3 -m ANSIController
```
> OR
```shell
ansicontroller
```
> Python Code
 ``` python
from ANSIController import Terminal  # Import Needed Class
terminal_control = Terminal()        # Create Object From Class Terminal
```
> To see all test 
```python
# print all styles with test example
Terminal.print_styles()
# print all colors with test example for background too and codes
Terminal.print_colors()
# print all colors & styles with codes
Terminal.print_colors_styles()
# print ids colors background and normal from 0 to 255
Terminal.print_id_colors()
# will print all pervious in same time
Terminal.print_test()
# Try it
Terminal.game()
```
## Output:
![Alt Text](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/test_styles.png)
![Alt Text](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/test_colors.png)
![Alt Text](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/test_ids.png)
### to move cursor
```python
# this will make cursor move to up 3 lines
terminal_control.move_to_up(steps=3)    

# After move to up 3 lines , cursor will start from 0 postion of line
terminal_control.move_to_up(steps=3,start_line=True)

# this will make cursor move to down 1 line
terminal_control.move_to_down(steps=1)  

# sometimes terminal not accept to move to up this function will force terminal to move up 1 line
terminal_control.force_move_to_up() 

# move cursor to home postion , make cursor in row 0 and col 0
terminal_control.move_to_home_postion()

# move cursor to custom postion row {num} col {num} in terminal screen
# here the cursor will move to row 14 ,column 20
terminal_control.move_to_line(row=14,col=20) 
```
### to hide cursor
```python
# hide cursor , try it
terminal_control.hide_cursor()
# show cursor if hidden
terminal_control.show_cursor()
# show cursor if hidden and hide if showen
terminal_control.toggle_cursor()
```
### To save cursor postion or restore cursror postion
```python
terminal_control.save_cursor_postion()   # Save Current Cursor postion row , column
# Restore Last Saved Cursor postion
terminal_control.restor_cursor_postion() # cursor will move auto to saved postion
```
### lets say i want to clear some text from terminal `\r no`
```python
terminal_control.clear_screen()             # Clear Terminal Screen it close to command `cls` and `clear`
terminal_control.clear_after_cursor()       # Clear Terminal Screen all text after cursor postion
terminal_control.clear_before_cursor()      # Clear Terminal Screen all text after cursor postion
terminal_control.clear_line()               # Clear Current line, of cursor postion row and start from first line
terminal_control.clear_line_after_cursor()  # Clear Current line, all text after cursor postion in same line
terminal_control.clear_line_before_cursor() # Clear Current line, all text before cursor postion in same line
```
### lets say i want to colorize some text
`By Using Concept of - Table of colors & style`
> Using Colors only no styles or background
> Colorize function take : text and seprator
> 
> syntax:
> 
> `sep some_style_codes_or_color_code sep`
> 
> for example `sep is []`
> 
> syntax will be:  `[some_style_codes_or_color_code]`
> 
```python
sep = "[]"
colorize_texts_using_color_char = [
    "[r]This is Red[0]",
    "[g]This is Green[0]",
    "[y]This is Yellow[0]",
    "[b]This is Black[0]",
    "[l]This is Blue[0]",
    "[m]This is Megenta[0]",
    "[c]This is Cyan[0]",
    "[w]This is White[0]",
    "[d]This is default[0]",
    "[bb]This is Bright Black[0]",
    "[br]This is Bright Red[0]",
]
for text in colorize_texts_using_color_char:
    print(terminal_control.colorize(text,sep))
```
## Output:
![Alt Text](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/test_colors_out.png)
> Now Using style only
> 
```python
sep = "[]"
colorize_texts_using_style_char = [
    "[B]This is Bold[0]",
    "[D]This is Dim[0]",
    "[I]This is Italic[0]",
    "[U]This is Underline[0]",
    "[L]This is Blinking[0]",
    "[R]This is reverse[0]",
    "[H]This is Hidden[0]",
    "[S]This is Strikethrogh[0]",
]
for text in colorize_texts_using_style_char:
    print(terminal_control.colorize(text,sep))
```
## Output:
![Alt Text](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/test_styles_out.png)
> Now Using Colors & style
> 
```python
sep = "[]"
colorize_texts_using_style_color_char = [
    "[Br]This is Bold and Red[0]",
    "[Dy]This is Dim and Yellow[0]",
    "[Il]This is Italic and Blue[0]",
    "[Ug]This is Underline and Green[0]",
    "[Lb]This is Blinking and black[0]",
    "[Rbr]This is reverse and Bright Red[0]",
    "[Hby]This is Hidden and Bright Yellow[0]",
    "[Sbc]This is Strikethrogh and Bright Cyan[0]",
]
for text in colorize_texts_using_style_color_char:
    print(terminal_control.colorize(text,sep))
```
## Output:
![Alt Text](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/test_colors_style_out.png)
> To add Background  just add `X,x` to the block `[xrB]` i want background red and bold style
> 
> Note: you can use `terminal_control.print_colorize` without print
> 
> `[0],[z],[Z],[Reset]` is to reset to default color&style in terminal
> 
> 
### - Using multiprogressbar
```python
# add_progress: take list of text
# take too dict
#example with list
terminal_control.add_progress([
    "[rB]test1[0]",
    "[w]test2[0]",
    "[cI]test3[0]",
    "[yD]test4[0]",
])
# example with dict
# take `progress_name`` to access later
# `txt` key is the progress text
terminal_control.add_progress({
    "progress1":{"txt": "[rB]test1[0]"},
    "progress2":{"txt": "[w]test2[0]"},
    "progress3":{"txt": "[cI]test3[0]"},
    "progress4":{"txt": "[yD]test4[0]"},
})
# now if i want to add progress value and update values
#example with list
# access by index
terminal_control.add_progress([
    "[rB]test1: (%c%/%m%)[0]",
    "[w]test2: %b% (%c%/%m%)[0]",
    "[cI]test3: %b% %p% (%c%/%m%)[0]",
    "[yD]test4: %f% [0]",
])
#example with more control dict
terminal_control.add_progress({
    "progress1":{
        "txt": "[rB]test1: (%c%/%m%) - (%key1%,%key2%,%status_test%)[0]",
        "mx":200,
        "inc":5,
        "custom":{
            "key1":10,
            "key2":"test",
            "status_test":"Good"
        }
    },
    # sometimes no need for `mx` or `inc`
    "progress2":{
        "txt": "[w]test2: %b% (%c%/%m%)- (%key1%,%key2%)[0]",
        "custom":{
            "key1":10,
            "key2":"test",
            "status_test":"Good"
        }
    },
    'progress_key1'|progress_key_integar:{
        'txt':string...,
        'mx':100,
        'inc':1,
        'custom':{},
        'bopen':'|',
        'bfill':'█',
        'bafill':'',
        'bempty':' '
        'bclose':'|',
    }
})

#----------------------------------------
# now to update progress bar values

# progress_key = `if list will be index`
# progress_key = `if dict will be name`
# `all` argument mean if u want to change in all texts
# default of all is False

# to change max value of custom texts
terminal_control.set_progress_max_value(150,"progress_key")
terminal_control.set_progress_max_value(150,all=True)

# to change auto increment value of custom texts
terminal_control.set_progress_inc_value(5,"progress_key")
terminal_control.set_progress_inc_value(5,all=True)

# to change text value of custom texts
terminal_control.set_progress_text("[rD]This is Text[0]","progress_key")
terminal_control.set_progress_text("[rD]This is Text[0]",all=True)

# to change or add custom value of custom texts
terminal_control.set_custom_value("key1","value1","progress_key")
terminal_control.set_custom_value("key1","value1",all=True)

#----------------------------------------
# now to update progress value

# this function more control in update
terminal_control.update(
    value = 13, # if no progress value, leave it
    progress_key="progress_key", # if no all, leave it
    all=True or False,
    custom_values={
        "key1":"value1",
        "key2":"value2"
    }
)
# if u want to auto update using `inc` value just call this
terminal_control.increase_progress("progress_key")
terminal_control.increase_progress(all=True)

#----------------------------------------
# now to print & check progress value
# to print all progress text with colorize mode
terminal_control.print_progress()
# to check is progress finish or not
terminal_control.is_progress_finish("progress_key")
terminal_control.is_progress_finish(all=True)
```
## Output:
![ProgressBar GIF](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/test_progress.gif)
## Ref
________________
- https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#escape
________________
## Tests
* ✅ `Windows 11 & 10 & 7`
  * work with no issue
* 👍 `Linux`
  * work but , maybe issue appear
  * Still Work on it
* 🔧 `Termux`
  * Some Features Need Rooted Device
  * Still Work on it
________________
### `if u face any issue dont be shy , say it`
## License

**MIT License**
**Copyright (c) 2023 [JoOx01]**

`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.`



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jo0x01/ansicontroller",
    "name": "ANSIController",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "cmd,ansi,terminal,ansi_terminal,ANSIControl,ANSIController,ASNI,ansicontroller,ansi_escape",
    "author": "JoOx01",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/b7/0e/844ca74a9f882d26421a01687eb7f451119c88cf165011f980e309ca4d0b/ANSIController-1.1.1.tar.gz",
    "platform": null,
    "description": "```sh\r\n\r\n#         d8888 888b    888  .d8888b. 8888888                                              \r\n#        d88888 8888b   888 d88P  Y88b  888                                                \r\n#       d88P888 88888b  888 Y88b.       888                                                \r\n#      d88P 888 888Y88b 888  \"Y888b.    888                                                \r\n#     d88P  888 888 Y88b888     \"Y88b.  888                                                \r\n#    d88P   888 888  Y88888       \"888  888                                                \r\n#   d8888888888 888   Y8888 Y88b  d88P  888                                                \r\n#  d88P     888 888    Y888  \"Y8888P\" 8888888                                              \r\n#                                                                                          \r\n#                                                                                          \r\n#                                                                                          \r\n#              .d8888b.                    888                    888 888                  \r\n#             d88P  Y88b                   888                    888 888                  \r\n#             888    888                   888                    888 888                  \r\n#             888         .d88b.  88888b.  888888 888d888 .d88b.  888 888  .d88b.  888d888 \r\n#             888        d88\"\"88b 888 \"88b 888    888P\"  d88\"\"88b 888 888 d8P  Y8b 888P\"   \r\n#             888    888 888  888 888  888 888    888    888  888 888 888 88888888 888     \r\n#             Y88b  d88P Y88..88P 888  888 Y88b.  888    Y88..88P 888 888 Y8b.     888     \r\n#              \"Y8888P\"   \"Y88P\"  888  888  \"Y888 888     \"Y88P\"  888 888  \"Y8888  888     \r\n#                                                                                         \r\n```\r\n# ANSI Controller\r\n> Basic Python Script to control cursor postion in terminal\r\n> and colorize any text in terminal , add any style to graphic mode in terminal\r\n\r\n<div style=\"\r\n    color: white;\r\n    background-color: #8B0000;\r\n    padding: 10px;\r\n    alignment: center;\r\n    text-align: center;\r\n\">\r\n<b>Note</b><br>\r\n! This Module work Depends of Terminal Type of support ANSI escape characters or not !\r\n<hr>\r\nif u face any issue write it\r\n</div>\r\n<br>\r\n\r\n# Note:\r\n> #### The Goal of writing this script is to make it easier to control the terminal by simply writing the name of the color or the name of the style of the text or moving the cursor by calling a function or deleting the text in the window, use it to learn how much it will make it easier for you if you are always using the command window\r\n\r\n\r\n[![PyPi](https://img.shields.io/badge/-PyPi-blue.svg?logo=pypi&labelColor=555555&style=for-the-badge)](https://pypi.org/project/ANSIController \"PyPi\") [![License: license](https://img.shields.io/badge/-license-blue.svg?style=for-the-badge)](LICENSE \"License\")\r\n\r\n[More Info About ANSI Escape Codes](`https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#escape`)\r\n\r\n## Tool Snap\r\n_______________\r\n![Alt Text](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/tool.png)\r\n\r\n## Features\r\n------------------------------\r\n`ANSI Controller` Features:\r\n- Move Cursor Right or left or top or down or postion in terminal screen\r\n- Colorize any text u want in terminal\r\n- Change Style of terminal printing text , bold ,italic , etc...\r\n- MultiProgress in same time\r\n## Tech\r\n------------------------------\r\n`ANSI Controller` uses a number of open source projects to work properly:\r\n- [keyboard] - pypi module `https://pypi.org/project/keyboard/`\r\n- `ANSI Controller` itself is open source on GitHub.\r\n- `More Info About ANSI Escape Codes: `https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#escape\r\n## Installation\r\n------------------------------\r\n\r\n`ANSI Controller` requires [pip](https://pypi.org/) to install.\r\nInstall the dependencies and devDependencies and start the script.\r\n### Windows\r\n```bash\r\npip install --upgrade ANSIController\r\n```\r\n### Linux && Termux\r\n```bash\r\npip3 install --upgrade ANSIController\r\n```\r\n# Table of colors & style\r\n- #### if terminal not support colorize the string will just remove from string\r\n- ### Note: Add Custom Values, to string to colorize the output\r\n> - ### [ID Colors](https://robotmoon.com/256-colors/): `<{id}>`  from 0 to 255 , `<255>` , `<15>`\r\n\r\n> - ### [RGB Colors](https://www.rapidtables.com/web/color/RGB_Color.html): `(red_value,green_value,blue_value)` from 0 to 255  , `(213,201,250)`\r\n> - ### [Hex RGB](https://www.rapidtables.com/web/color/RGB_Color.html): `#FFFFFF` using hex , `#4affa1`\r\n\r\n- #### Background: `X,x`\r\n- #### Reset: `Z,0,reset,Reset`\r\n- #### Colors:\r\n    - [+] `black:`              `b,black,30`\r\n    - [+] `red:`                `r,red,31`\r\n    - [+] `green:`              `g,green,32`\r\n    - [+] `yellow:`             `y,yellow,33`\r\n    - [+] `blue:`               `l,blue,34`\r\n    - [+] `magenta:`            `m,magenta,35`\r\n    - [+] `cyan:`               `c,cyan,36`\r\n    - [+] `white:`              `w,white,37`\r\n    - [+] `default:`            `d,default,39`\r\n    - [+] `bright black:`       `bb,bblack,90`\r\n    - [+] `bright red:`         `br,bred,91`\r\n    - [+] `bright green:`       `bg,bgreen,92`\r\n    - [+] `bright yellow:`      `by,byellow,93`\r\n    - [+] `bright blue:`        `bl,bblue,94`\r\n    - [+] `bright magenta`      `bm,bmagenta,95`\r\n    - [+] `bright cyan:`        `bc,bcyan,96`\r\n    - [+] `bright white:`       `bw,bwhite,97`\r\n- #### Styles:\r\n    - [+] `bold:`               `B,bold,1`\r\n    - [+] `dim:`                `D,dim,2`\r\n    - [+] `italic:`             `I,italic,3`\r\n    - [+] `underline:`          `U,underline,4`\r\n    - [+] `blinking:`           `L,blinking,5`\r\n    - [+] `reverse:`            `R,reverse,7`\r\n    - [+] `hidden:`             `H,hidden,8`\r\n    - [+] `strikethrough:`      `S,strikethrough,9`\r\n- #### ProgressBar: add `%{char}%`\r\n    - [+] `c:`                  `current progress value`\r\n    - [+] `m:`                  `max progress value`\r\n    - [+] `p:`                  `percent progress value`\r\n    - [+] `b:`                  `bar progress value`\r\n    - [+] `f:`                  `print full bar with all info`\r\n    - [+] `e:` `Elapsed Time`\r\n    - [+] `r:` `Remaining Time`\r\n    - [+] `s:` `Speed`\r\n    - [+]  `your_custom_key:`    `your_custom_value`\r\n- #### More Control in ProgressBar:\r\n    - [+] `txt:`                `key of string value inside`\r\n    - [+] `mx:`                 `max value default is 100`\r\n    - [+] `inc:`                `increamnt value defualt is 1`\r\n    - [+] `bopen:` `bar open char default '|'`\r\n    - [+] `bfill:` `bar filled char default '\u2588'`\r\n    - [+] `bafill:` `bar after filled char default ''`\r\n    - [+] `bempty:` `bar empty char default ' '`\r\n    - [+] `bclose:` `bar close char default ' '`\r\n    - [+] `custom:`             `dict object with custom keys`\r\n## Examples & Usage\r\n____________\r\n> Terminal Execute\r\n### windows\r\n```shell\r\npython -m ANSIController\r\n```\r\n> OR\r\n```shell\r\nansicontroller\r\n```\r\n### Linux && Termux\r\n```shell\r\npython3 -m ANSIController\r\n```\r\n> OR\r\n```shell\r\nansicontroller\r\n```\r\n> Python Code\r\n ``` python\r\nfrom ANSIController import Terminal  # Import Needed Class\r\nterminal_control = Terminal()        # Create Object From Class Terminal\r\n```\r\n> To see all test \r\n```python\r\n# print all styles with test example\r\nTerminal.print_styles()\r\n# print all colors with test example for background too and codes\r\nTerminal.print_colors()\r\n# print all colors & styles with codes\r\nTerminal.print_colors_styles()\r\n# print ids colors background and normal from 0 to 255\r\nTerminal.print_id_colors()\r\n# will print all pervious in same time\r\nTerminal.print_test()\r\n# Try it\r\nTerminal.game()\r\n```\r\n## Output:\r\n![Alt Text](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/test_styles.png)\r\n![Alt Text](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/test_colors.png)\r\n![Alt Text](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/test_ids.png)\r\n### to move cursor\r\n```python\r\n# this will make cursor move to up 3 lines\r\nterminal_control.move_to_up(steps=3)    \r\n\r\n# After move to up 3 lines , cursor will start from 0 postion of line\r\nterminal_control.move_to_up(steps=3,start_line=True)\r\n\r\n# this will make cursor move to down 1 line\r\nterminal_control.move_to_down(steps=1)  \r\n\r\n# sometimes terminal not accept to move to up this function will force terminal to move up 1 line\r\nterminal_control.force_move_to_up() \r\n\r\n# move cursor to home postion , make cursor in row 0 and col 0\r\nterminal_control.move_to_home_postion()\r\n\r\n# move cursor to custom postion row {num} col {num} in terminal screen\r\n# here the cursor will move to row 14 ,column 20\r\nterminal_control.move_to_line(row=14,col=20) \r\n```\r\n### to hide cursor\r\n```python\r\n# hide cursor , try it\r\nterminal_control.hide_cursor()\r\n# show cursor if hidden\r\nterminal_control.show_cursor()\r\n# show cursor if hidden and hide if showen\r\nterminal_control.toggle_cursor()\r\n```\r\n### To save cursor postion or restore cursror postion\r\n```python\r\nterminal_control.save_cursor_postion()   # Save Current Cursor postion row , column\r\n# Restore Last Saved Cursor postion\r\nterminal_control.restor_cursor_postion() # cursor will move auto to saved postion\r\n```\r\n### lets say i want to clear some text from terminal `\\r no`\r\n```python\r\nterminal_control.clear_screen()             # Clear Terminal Screen it close to command `cls` and `clear`\r\nterminal_control.clear_after_cursor()       # Clear Terminal Screen all text after cursor postion\r\nterminal_control.clear_before_cursor()      # Clear Terminal Screen all text after cursor postion\r\nterminal_control.clear_line()               # Clear Current line, of cursor postion row and start from first line\r\nterminal_control.clear_line_after_cursor()  # Clear Current line, all text after cursor postion in same line\r\nterminal_control.clear_line_before_cursor() # Clear Current line, all text before cursor postion in same line\r\n```\r\n### lets say i want to colorize some text\r\n`By Using Concept of - Table of colors & style`\r\n> Using Colors only no styles or background\r\n> Colorize function take : text and seprator\r\n> \r\n> syntax:\r\n> \r\n> `sep some_style_codes_or_color_code sep`\r\n> \r\n> for example `sep is []`\r\n> \r\n> syntax will be:  `[some_style_codes_or_color_code]`\r\n> \r\n```python\r\nsep = \"[]\"\r\ncolorize_texts_using_color_char = [\r\n    \"[r]This is Red[0]\",\r\n    \"[g]This is Green[0]\",\r\n    \"[y]This is Yellow[0]\",\r\n    \"[b]This is Black[0]\",\r\n    \"[l]This is Blue[0]\",\r\n    \"[m]This is Megenta[0]\",\r\n    \"[c]This is Cyan[0]\",\r\n    \"[w]This is White[0]\",\r\n    \"[d]This is default[0]\",\r\n    \"[bb]This is Bright Black[0]\",\r\n    \"[br]This is Bright Red[0]\",\r\n]\r\nfor text in colorize_texts_using_color_char:\r\n    print(terminal_control.colorize(text,sep))\r\n```\r\n## Output:\r\n![Alt Text](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/test_colors_out.png)\r\n> Now Using style only\r\n> \r\n```python\r\nsep = \"[]\"\r\ncolorize_texts_using_style_char = [\r\n    \"[B]This is Bold[0]\",\r\n    \"[D]This is Dim[0]\",\r\n    \"[I]This is Italic[0]\",\r\n    \"[U]This is Underline[0]\",\r\n    \"[L]This is Blinking[0]\",\r\n    \"[R]This is reverse[0]\",\r\n    \"[H]This is Hidden[0]\",\r\n    \"[S]This is Strikethrogh[0]\",\r\n]\r\nfor text in colorize_texts_using_style_char:\r\n    print(terminal_control.colorize(text,sep))\r\n```\r\n## Output:\r\n![Alt Text](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/test_styles_out.png)\r\n> Now Using Colors & style\r\n> \r\n```python\r\nsep = \"[]\"\r\ncolorize_texts_using_style_color_char = [\r\n    \"[Br]This is Bold and Red[0]\",\r\n    \"[Dy]This is Dim and Yellow[0]\",\r\n    \"[Il]This is Italic and Blue[0]\",\r\n    \"[Ug]This is Underline and Green[0]\",\r\n    \"[Lb]This is Blinking and black[0]\",\r\n    \"[Rbr]This is reverse and Bright Red[0]\",\r\n    \"[Hby]This is Hidden and Bright Yellow[0]\",\r\n    \"[Sbc]This is Strikethrogh and Bright Cyan[0]\",\r\n]\r\nfor text in colorize_texts_using_style_color_char:\r\n    print(terminal_control.colorize(text,sep))\r\n```\r\n## Output:\r\n![Alt Text](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/test_colors_style_out.png)\r\n> To add Background  just add `X,x` to the block `[xrB]` i want background red and bold style\r\n> \r\n> Note: you can use `terminal_control.print_colorize` without print\r\n> \r\n> `[0],[z],[Z],[Reset]` is to reset to default color&style in terminal\r\n> \r\n> \r\n### - Using multiprogressbar\r\n```python\r\n# add_progress: take list of text\r\n# take too dict\r\n#example with list\r\nterminal_control.add_progress([\r\n    \"[rB]test1[0]\",\r\n    \"[w]test2[0]\",\r\n    \"[cI]test3[0]\",\r\n    \"[yD]test4[0]\",\r\n])\r\n# example with dict\r\n# take `progress_name`` to access later\r\n# `txt` key is the progress text\r\nterminal_control.add_progress({\r\n    \"progress1\":{\"txt\": \"[rB]test1[0]\"},\r\n    \"progress2\":{\"txt\": \"[w]test2[0]\"},\r\n    \"progress3\":{\"txt\": \"[cI]test3[0]\"},\r\n    \"progress4\":{\"txt\": \"[yD]test4[0]\"},\r\n})\r\n# now if i want to add progress value and update values\r\n#example with list\r\n# access by index\r\nterminal_control.add_progress([\r\n    \"[rB]test1: (%c%/%m%)[0]\",\r\n    \"[w]test2: %b% (%c%/%m%)[0]\",\r\n    \"[cI]test3: %b% %p% (%c%/%m%)[0]\",\r\n    \"[yD]test4: %f% [0]\",\r\n])\r\n#example with more control dict\r\nterminal_control.add_progress({\r\n    \"progress1\":{\r\n        \"txt\": \"[rB]test1: (%c%/%m%) - (%key1%,%key2%,%status_test%)[0]\",\r\n        \"mx\":200,\r\n        \"inc\":5,\r\n        \"custom\":{\r\n            \"key1\":10,\r\n            \"key2\":\"test\",\r\n            \"status_test\":\"Good\"\r\n        }\r\n    },\r\n    # sometimes no need for `mx` or `inc`\r\n    \"progress2\":{\r\n        \"txt\": \"[w]test2: %b% (%c%/%m%)- (%key1%,%key2%)[0]\",\r\n        \"custom\":{\r\n            \"key1\":10,\r\n            \"key2\":\"test\",\r\n            \"status_test\":\"Good\"\r\n        }\r\n    },\r\n    'progress_key1'|progress_key_integar:{\r\n        'txt':string...,\r\n        'mx':100,\r\n        'inc':1,\r\n        'custom':{},\r\n        'bopen':'|',\r\n        'bfill':'\u2588',\r\n        'bafill':'',\r\n        'bempty':' '\r\n        'bclose':'|',\r\n    }\r\n})\r\n\r\n#----------------------------------------\r\n# now to update progress bar values\r\n\r\n# progress_key = `if list will be index`\r\n# progress_key = `if dict will be name`\r\n# `all` argument mean if u want to change in all texts\r\n# default of all is False\r\n\r\n# to change max value of custom texts\r\nterminal_control.set_progress_max_value(150,\"progress_key\")\r\nterminal_control.set_progress_max_value(150,all=True)\r\n\r\n# to change auto increment value of custom texts\r\nterminal_control.set_progress_inc_value(5,\"progress_key\")\r\nterminal_control.set_progress_inc_value(5,all=True)\r\n\r\n# to change text value of custom texts\r\nterminal_control.set_progress_text(\"[rD]This is Text[0]\",\"progress_key\")\r\nterminal_control.set_progress_text(\"[rD]This is Text[0]\",all=True)\r\n\r\n# to change or add custom value of custom texts\r\nterminal_control.set_custom_value(\"key1\",\"value1\",\"progress_key\")\r\nterminal_control.set_custom_value(\"key1\",\"value1\",all=True)\r\n\r\n#----------------------------------------\r\n# now to update progress value\r\n\r\n# this function more control in update\r\nterminal_control.update(\r\n    value = 13, # if no progress value, leave it\r\n    progress_key=\"progress_key\", # if no all, leave it\r\n    all=True or False,\r\n    custom_values={\r\n        \"key1\":\"value1\",\r\n        \"key2\":\"value2\"\r\n    }\r\n)\r\n# if u want to auto update using `inc` value just call this\r\nterminal_control.increase_progress(\"progress_key\")\r\nterminal_control.increase_progress(all=True)\r\n\r\n#----------------------------------------\r\n# now to print & check progress value\r\n# to print all progress text with colorize mode\r\nterminal_control.print_progress()\r\n# to check is progress finish or not\r\nterminal_control.is_progress_finish(\"progress_key\")\r\nterminal_control.is_progress_finish(all=True)\r\n```\r\n## Output:\r\n![ProgressBar GIF](https://raw.githubusercontent.com/Jo0X01/ANSIController/main/tests/test_progress.gif)\r\n## Ref\r\n________________\r\n- https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#escape\r\n________________\r\n## Tests\r\n* \u2705 `Windows 11 & 10 & 7`\r\n  * work with no issue\r\n* \ud83d\udc4d `Linux`\r\n  * work but , maybe issue appear\r\n  * Still Work on it\r\n* \ud83d\udd27 `Termux`\r\n  * Some Features Need Rooted Device\r\n  * Still Work on it\r\n________________\r\n### `if u face any issue dont be shy , say it`\r\n## License\r\n\r\n**MIT License**\r\n**Copyright (c) 2023 [JoOx01]**\r\n\r\n`Permission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\nSOFTWARE.`\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Basic Python Module to control & color & style text in terminal",
    "version": "1.1.1",
    "project_urls": {
        "Homepage": "https://github.com/jo0x01/ansicontroller"
    },
    "split_keywords": [
        "cmd",
        "ansi",
        "terminal",
        "ansi_terminal",
        "ansicontrol",
        "ansicontroller",
        "asni",
        "ansicontroller",
        "ansi_escape"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2851efdfa01321321fc904155a6c1ce7a05564361ddf7beb4821997cca524b3f",
                "md5": "51284bb7ad9a466df24353b4c449784c",
                "sha256": "06a9028ee1478922cea1524b97474557d9dc3aacd5ce560be1ffe50678985b48"
            },
            "downloads": -1,
            "filename": "ANSIController-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "51284bb7ad9a466df24353b4c449784c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 24639,
            "upload_time": "2023-08-29T05:28:10",
            "upload_time_iso_8601": "2023-08-29T05:28:10.282809Z",
            "url": "https://files.pythonhosted.org/packages/28/51/efdfa01321321fc904155a6c1ce7a05564361ddf7beb4821997cca524b3f/ANSIController-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b70e844ca74a9f882d26421a01687eb7f451119c88cf165011f980e309ca4d0b",
                "md5": "0cf2e7ef3e1e798fb10bf2b0f1da8541",
                "sha256": "be18ca9c18b65522c691dc7cf104c693f93a7542eebd809f634ab3ea05e1381f"
            },
            "downloads": -1,
            "filename": "ANSIController-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0cf2e7ef3e1e798fb10bf2b0f1da8541",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 26044,
            "upload_time": "2023-08-29T05:28:11",
            "upload_time_iso_8601": "2023-08-29T05:28:11.658285Z",
            "url": "https://files.pythonhosted.org/packages/b7/0e/844ca74a9f882d26421a01687eb7f451119c88cf165011f980e309ca4d0b/ANSIController-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-29 05:28:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jo0x01",
    "github_project": "ansicontroller",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "ansicontroller"
}
        
Elapsed time: 0.15879s