# Conlay - Console Layout
[![PyPi version][shields-pypi_version]][url-pypi_version]
[![Github Issues][shields-issues]][url-issues]
[![Github License][shields-license]][url-license]
Create visually pleasing console layouts with this easy-to-use Python library.
## Installing
Install using <a href="https://pip.pypa.io/en/stable/">pip</a>
```bash
pip install conlay
```
or install it from <a href="https://pypi.org/project/conlay/#files">PyPi</a>
## Example
```python
from conlay import *
layout = Conlay()
blank_box = BoldBox(0, 0, 30, 5)
layout.add(blank_box)
label = ThinLabel(0, 0, "this is a test")
blank_box.add(label)
layout.print()
```
Console output:
```
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃╭──────────────╮ ┃
┃│this is a test│ ┃
┃╰──────────────╯ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
>
```
## Conlay()
`Conlay()` is the core class within the library. It generates and prints out the layout.
```python
layout = Conlay()
```
There are some attributes that can be used to modify or update the positioning, scale, color and other things. Because each <a href="https://github.com/Salliii/conlay#layoutelement">LayoutElement()</a> is a subclass of `Conlay()`, each <a href="https://github.com/Salliii/conlay#layoutelement">LayoutElement()</a> has the same attributes.
| attribute | description | expected type | default value |
| :-------- | :---------- | :------------ | :------------ |
| `relative_x` | Relative x-position to the parent object | `int` | 0 |
| `relative_y` | Relative y-position to the parent object | `int` | 0 |
| `absolute_x` | Absolute x-position | `int` | 0 |
| `absolute_y` | Absolute y-position | `int` | 0 |
| `width` | Elements width | `int` | 0 |
| `min_width` | Minimal width. May limit the specified with | `int` | 0 |
| `max_width` | Maximal width. May limit the specified with | `int` | 0 |
| `height` | Elements height | `int` | 0 |
| `min_height` | Minimal height. May limit the specified with | `int` | 0 |
| `max_height` | Maximal height. May limit the specified with | `int` | 0 |
| `zindex` | Indicates whether an element is printed above or below other elements | `int` | 0 |
| `padding_x` | Specifies the padding on the x axis, which affects the absolute position of the child elements | `int` | 0 |
| `padding_y` | Specifies the padding on the y axis, which affects the absolute position of the child elements | `int` | 0 |
| `text` | Specifies the text content | `str` | n/a |
| `placeholder` | Specifies the placeholder content | `str` | n/a |
| `content` | Stores the text content of the input element, etc. | `str` | n/a |
| `background` | Specifies whether the element should have a background or not | `bool` | False |
| `background_color` | Specifies the background color | <a href="https://github.com/Salliii/conlay#colorbg">`Color.Bg`</a> | Color.Bg.clear |
| `border_color` | Specifies the border color | <a href="https://github.com/Salliii/conlay#colorfg">`Color.Fg`</a> | Color.Fg.clear |
| `text_color` | Specifies the text color | <a href="https://github.com/Salliii/conlay#colorfg">`Color.Fg`</a> | Color.Fg.clear |
| `placeholder_color` | Specifies the placeholder color | <a href="https://github.com/Salliii/conlay#colorfg">`Color.Fg`</a> | Color.Fg.rgb(150, 150, 150) |
### Conlay.add()
You can use `add()` to add <a href="https://github.com/Salliii/conlay#layoutelement">LayoutElements</a> to other <a href="https://github.com/Salliii/conlay#layoutelement">LayoutElements</a>.
Syntax:
```python
parent.add(child)
```
| argument | description | expected type |
| :------- | :---------- | :------------ |
| `child` | child element | <a href="https://github.com/Salliii/conlay#layoutelement">LayoutElements()</a> or one of its subclasses such as <a href="https://github.com/Salliii/conlay#box">Box()</a>, <a href="https://github.com/Salliii/conlay#label">Label()</a>, etc. |
Example:
```python
# add a LayoutElement to the main layout
layout = Conlay()
layout.add(ThinBox(...))
# add a LayoutElement to another LayoutElement
BoldBox(...).add(ThinLabel(...))
```
### Conlay.print()
You have to call `print()` to generate and print out the layout.
Syntax:
```python
layout.print()
```
Example:
```python
layout = Conlay()
...
layout.print()
```
## LayoutElement()
The `LayoutElement()` class serves as a superclass for all other layout elements such as <a href="https://github.com/Salliii/conlay#box">Box()</a>, <a href="https://github.com/Salliii/conlay#label">Label()</a>, etc.
Syntax:
```python
element = LayoutElement(x, y, w, h, border)
```
| argument | description | expected type |
| :------- | :---------- | :------------ |
| `x` | Relative x-position to its parent element | `int` |
| `y` | Relative y-position to its parent element | `int` |
| `w` | Elements width | `int` |
| `h` | Elements height | `int` |
| `border` | Borders character set | <a href="https://github.com/Salliii/conlay#border">Border()</a> or one of its subclasses such as <a href="https://github.com/Salliii/conlay#bold">Bold()</a> or <a href="https://github.com/Salliii/conlay#thin">Thin()</a> |
Example:
```python
from conlay import *
layout = Conlay()
element = LayoutElement(0, 0, 30, 5, Thin())
layout.add(element)
layout.print()
```
Console output:
```
╭────────────────────────────╮
│ │
│ │
│ │
╰────────────────────────────╯
>
```
## Box()
The `Box()` class is a subclass of the <a href="https://github.com/Salliii/conlay#layoutelement">LayoutElement()</a> class and is used to create a simple box.
Syntax:
```python
element = Box(x, y, w, h, border)
```
| argument | description | expected type |
| :------- | :---------- | :------------ |
| `x` | Relative x-position to its parent element | `int` |
| `y` | Relative y-position to its parent element | `int` |
| `w` | Elements width | `int` |
| `h` | Elements height | `int` |
| `border` | Borders character set | <a href="https://github.com/Salliii/conlay#border">Border()</a> or one of its subclasses such as <a href="https://github.com/Salliii/conlay#bold">Bold()</a> or <a href="https://github.com/Salliii/conlay#thin">Thin()</a> |
Example:
```python
from conlay import *
layout = Conlay()
box = Box(0, 0, 30, 5, Thin())
layout.add(box)
layout.print()
```
Console output:
```
╭────────────────────────────╮
│ │
│ │
│ │
╰────────────────────────────╯
>
```
## ThinBox()
The `ThinBox()` class is a subclass of the <a href="https://github.com/Salliii/conlay#box">Box()</a> class and is used to create a simple box with a <a href="https://github.com/Salliii/conlay#thin">Thin()</a> Border.
Syntax:
```python
element = ThinBox(x, y, w, h)
```
| argument | description | expected type |
| :------- | :---------- | :------------ |
| `x` | Relative x-position to its parent element | `int` |
| `y` | Relative y-position to its parent element | `int` |
| `w` | Elements width | `int` |
| `h` | Elements height | `int` |
Example:
```python
from conlay import *
layout = Conlay()
thinbox = ThinBox(0, 0, 30, 5)
layout.add(thinbox)
layout.print()
```
Console output:
```
╭────────────────────────────╮
│ │
│ │
│ │
╰────────────────────────────╯
>
```
## BoldBox()
The `BoldBox()` class is a subclass of the <a href="https://github.com/Salliii/conlay#box">Box()</a> class and is used to create a simple box with a <a href="https://github.com/Salliii/conlay#bold">Bold()</a> Border.
Syntax:
```python
element = BoldBox(x, y, w, h)
```
| argument | description | expected type |
| :------- | :---------- | :------------ |
| `x` | Relative x-position to its parent element | `int` |
| `y` | Relative y-position to its parent element | `int` |
| `w` | Elements width | `int` |
| `h` | Elements height | `int` |
Example:
```python
from conlay import *
layout = Conlay()
boldbox = BoldBox(0, 0, 30, 5)
layout.add(boldbox)
layout.print()
```
Console output:
```
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃
┃ ┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
>
```
## Label()
The `Label()` class is a subclass of the <a href="https://github.com/Salliii/conlay#layoutelement">LayoutElement()</a> class and is used to create a simple box.
Syntax:
```python
element = Label(x, y, text, border)
```
| argument | description | expected type |
| :------- | :---------- | :------------ |
| `x` | Relative x-position to its parent element | `int` |
| `y` | Relative y-position to its parent element | `int` |
| `text` | Text content | `str` |
| `border` | Borders character set | <a href="https://github.com/Salliii/conlay#border">Border()</a> or one of its subclasses such as <a href="https://github.com/Salliii/conlay#bold">Bold()</a> or <a href="https://github.com/Salliii/conlay#thin">Thin()</a> |
```python
from conlay import *
layout = Conlay()
label = Label(0, 0, "this is a test", Thin())
layout.add(label)
layout.print()
```
Console output:
```
╭──────────────╮
│this is a test│
╰──────────────╯
>
```
## ThinLabel()
The `ThinLabel()` class is a subclass of the <a href="https://github.com/Salliii/conlay#label">Label()</a> class and is used to create a simple label with a <a href="https://github.com/Salliii/conlay#thin">Thin()</a> Border.
Syntax:
```python
element = ThinLabel(x, y, text)
```
| argument | description | expected type |
| :------- | :---------- | :------------ |
| `x` | Relative x-position to its parent element | `int` |
| `y` | Relative y-position to its parent element | `int` |
| `text` | Text content | `str` |
```python
from conlay import *
layout = Conlay()
thinlabel = ThinLabel(0, 0, "this is a test")
layout.add(thinlabel)
layout.print()
```
Console output:
```
╭──────────────╮
│this is a test│
╰──────────────╯
>
```
## BoldLabel()
The `BoldLabel()` class is a subclass of the <a href="https://github.com/Salliii/conlay#label">Label()</a> class and is used to create a simple label with a <a href="https://github.com/Salliii/conlay#bold">Bold()</a> Border.
Syntax:
```python
element = BoldLabel(x, y, text)
```
| argument | description | expected type |
| :------- | :---------- | :------------ |
| `x` | Relative x-position to its parent element | `int` |
| `y` | Relative y-position to its parent element | `int` |
| `text` | Text content | `str` |
```python
from conlay import *
layout = Conlay()
boldlabel = BoldLabel(0, 0, "this is a test")
layout.add(boldlabel)
layout.print()
```
Console output:
```
┏━━━━━━━━━━━━━━┓
┃this is a test┃
┗━━━━━━━━━━━━━━┛
>
```
## Input()
The `Input()` class is a subclass of the <a href="https://github.com/Salliii/conlay#layoutelement">LayoutElement()</a> class and is used to create a input field.
Syntax:
```python
element = Input(x, y, text, length, border)
```
| argument | description | expected type |
| :------- | :---------- | :------------ |
| `x` | Relative x-position to its parent element | `int` |
| `y` | Relative y-position to its parent element | `int` |
| `text` | Text content | `str` |
| `length` | expected input length | `int` |
| `border` | Borders character set | <a href="https://github.com/Salliii/conlay#border">Border()</a> or one of its subclasses such as <a href="https://github.com/Salliii/conlay#bold">Bold()</a> or <a href="https://github.com/Salliii/conlay#thin">Thin()</a> |
```python
from conlay import *
layout = Conlay()
input_element = Input(0, 0, "input:", 10, Thin())
layout.add(input_element)
layout.print()
```
Console output:
```
╭────────────────╮
│input: │
╰────────────────╯
>
```
after you've entered a text, you can get it with the element.content variable
```python
from conlay import *
layout = Conlay()
input_element = Input(0, 0, "input:", 10, Thin())
layout.add(input_element)
layout.print()
print(input_element.content)
```
## ThinInput()
The `ThinInput()` class is a subclass of the <a href="https://github.com/Salliii/conlay#input">Input()</a> class and is used to create a simple input field with a <a href="https://github.com/Salliii/conlay#thin">Thin()</a> Border.
Syntax:
```python
element = ThinInput(x, y, text, length)
```
| argument | description | expected type |
| :------- | :---------- | :------------ |
| `x` | Relative x-position to its parent element | `int` |
| `y` | Relative y-position to its parent element | `int` |
| `text` | Text content | `str` |
| `length` | expected input length | `int` |
```python
from conlay import *
layout = Conlay()
input_element = ThinInput(0, 0, "input:", 10)
layout.add(input_element)
layout.print()
```
Console output:
```
╭────────────────╮
│input: │
╰────────────────╯
>
```
## BoldInput()
The `BoldInput()` class is a subclass of the <a href="https://github.com/Salliii/conlay#input">Input()</a> class and is used to create a simple input field with a <a href="https://github.com/Salliii/conlay#bold">Bold()</a> Border.
Syntax:
```python
element = BoldInput(x, y, text, length)
```
| argument | description | expected type |
| :------- | :---------- | :------------ |
| `x` | Relative x-position to its parent element | `int` |
| `y` | Relative y-position to its parent element | `int` |
| `text` | Text content | `str` |
| `length` | expected input length | `int` |
```python
from conlay import *
layout = Conlay()
input_element = BoldInput(0, 0, "input:", 10)
layout.add(input_element)
layout.print()
```
Console output:
```
┏━━━━━━━━━━━━━━━━┓
┃input: ┃
┗━━━━━━━━━━━━━━━━┛
>
```
## Cursor
The `Cursor` class provides a few functions for simple <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797">Ansi Escape</a> cursor actions.
### Cursor.setPosition()
Set the cursor to a specific position. The <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797">Ansi Escape Sequence</a> used for this command is `\x1b[<y>;<x>H`.
Syntax:
```python
Cursor.setPosition(x, y)
```
Example:
```python
Cursor.setPosition(10, 5)
```
### Cursor.shiftHorizontal()
Move the cursor along the X axis. The <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797">Ansi Escape Sequence</a> used for this command is `\x1b[<x>D` and `\x1b[<x>C`.
Syntax:
```python
Cursor.shiftHorizontal(x)
```
Example:
```python
# move the cursor 10 collumns to the right
Cursor.shiftHorizontal(10)
# move the cursor 5 collumns to the left
Cursor.shiftHorizontal(-5)
```
### Cursor.shiftVertical()
Move the cursor along the Y axis. The <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797">Ansi Escape Sequence</a> used for this command is `\x1b[<y>A` and `\x1b[<y>B`.
Syntax:
```python
Cursor.shiftVertical(y)
```
Example:
```python
# move the cursor 10 collumns down
Cursor.shiftVertical(10)
# move the cursor 5 collumns up
Cursor.shiftVertical(-5)
```
### Cursor.hide()
Hides the cursor. The <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797">Ansi Escape Sequence</a> used for this command is `\x1b[?25l`.
Syntax:
```python
Cursor.hide()
```
### Cursor.show()
Shows the cursor. The <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797">Ansi Escape Sequence</a> used for this command is `\x1b[?25h`.
Syntax:
```python
Cursor.show()
```
## Console
The `Console` class provides a few functions for simple <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797">Ansi Escape</a> console actions.
### Console.reset()
This Function resets the console. The <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797">Ansi Escape Sequence</a> used for this command is `\x1bc`.
Syntax:
```python
Console.reset()
```
### Console.clear()
This Function clears the console. The <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797">Ansi Escape Sequence</a> used for this command is `\x1b[3J`.
Syntax:
```python
Console.clear()
```
### Console.eraseLineToEnd()
Erase the line from the cursor position to the end. The <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797">Ansi Escape Sequence</a> used for this command is `\x1b[0K`.
Syntax:
```python
Console.eraseLineToEnd()
```
### Console.eraseLineFromStart()
Erase the line from start to the cursor position. The <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797">Ansi Escape Sequence</a> used for this command is `\x1b[1K`.
Syntax:
```python
Console.eraseLineFromStart()
```
### Console.eraseLine()
Erase the line. The <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797">Ansi Escape Sequence</a> used for this command is `\x1b[2K`.
Syntax:
```python
Console.eraseLine()
```
## Color
The `Color` class allows you to set the foreground and background color using the <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#color-codes">Ansi Escape Color Codes</a>.
### Color.Bg
The `Color.Bg` class provides a few predefined background <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#color-codes">Ansi Escape Color Codes</a>.
| Variable Name | rgb values | ansi escape sequence |
| :------------ | :--------- | :------------------- |
| Color.Bg.black | 0, 0, 0 | `\x1b[49m` |
| Color.Bg.black | 0, 0, 0 | `\x1b[48;2;0;0;0m` |
| Color.Bg.white | 255, 255, 255 | `\x1b[48;2;255;255;255m` |
| Color.Bg.red | 205, 49, 49 | `\x1b[48;2;205;49;49m` |
| Color.Bg.green | 13, 188, 121 | `\x1b[48;2;13;188;121m` |
| Color.Bg.blue | 36, 114, 200 | `\x1b[48;2;36;114;200m` |
| Color.Bg.yellow | 229, 229, 16 | `\x1b[48;2;229;229;16m` |
| Color.Bg.purple | 188, 63, 188 | `\x1b[48;2;188;63;188m` |
| Color.Bg.cyan | 17, 168, 205 | `\x1b[48;2;17;168;205m` |
### Color.Bg.rgb()
This function takes three arguments `r, g, b` and returns a customized background <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#color-codes">Ansi Escape Color Code</a>
Syntax:
```python
Color.Bg.rgb(r, g, b)
```
Example:
```python
>>> Color.Bg.rgb(255, 0, 100)
'\x1b[48;2;255;0;100m'
```
### Color.Fg
The `Color.Fg` class provides a few predefined foreground <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#color-codes">Ansi Escape Color Codes</a>.
| Variable Name | rgb values | ansi escape sequence |
| :------------ | :--------- | :------------------- |
| Color.Bg.black | 0, 0, 0 | `\x1b[39m` |
| Color.Fg.black | 0, 0, 0 | `\x1b[38;2;0;0;0m` |
| Color.Fg.white | 255, 255, 255 | `\x1b[38;2;255;255;255m` |
| Color.Fg.red | 205, 49, 49 | `\x1b[38;2;205;49;49m` |
| Color.Fg.green | 13, 188, 121 | `\x1b[38;2;13;188;121m` |
| Color.Fg.blue | 36, 114, 200 | `\x1b[38;2;36;114;200m` |
| Color.Fg.yellow | 229, 229, 16 | `\x1b[38;2;229;229;16m` |
| Color.Fg.purple | 188, 63, 188 | `\x1b[38;2;188;63;188m` |
| Color.Fg.cyan | 17, 168, 205 | `\x1b[38;2;17;168;205m` |
### Color.Fg.rgb()
This function takes three arguments `r, g, b` and returns a customized foreground <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#color-codes">Ansi Escape Color Code</a>
Syntax:
```python
Color.Fg.rgb(r, g, b)
```
Example:
```python
>>> Color.Fg.rgb(255, 0, 100)
'\x1b[38;2;255;0;100m'
```
## Border
The `Border()` class and its subclasses serve as a character set and define the required Unicode characters.
| class attributes | unicode characters |
| :--------------- | :----------------- |
| `vertical` | n/a |
| `horizontal` | n/a |
| `top_left` | n/a |
| `top_right` | n/a |
| `bottom_left` | n/a |
| `bottom_right` | n/a |
## Thin()
The `Thin()` class is a subclass of <a href="https://github.com/Salliii/conlay#border">Border()</a> and serves as a character set and defines the required thin Unicode characters.
| class attributes | unicode characters |
| :--------------- | :----------------- |
| `vertical` | `\u2503` |
| `horizontal` | `\u2501` |
| `top_left` | `\u250F` |
| `top_right` | `\u2513` |
| `bottom_left` | `\u2517` |
| `bottom_right` | `\u251B` |
## Bold()
The `Bold()` class is a subclass of <a href="https://github.com/Salliii/conlay#border">Border()</a> and serves as a character set and defines the required bold Unicode characters.
| class attributes | unicode characters |
| :--------------- | :----------------- |
| `vertical` | `\u2502` |
| `horizontal` | `\u2500` |
| `top_left` | `\u256D` |
| `top_right` | `\u256E` |
| `bottom_left` | `\u2570` |
| `bottom_right` | `\u256F` |
## Summary
- <a href="https://github.com/Salliii/conlay#conlay">Conlay()</a>
- <a href="https://github.com/Salliii/conlay#conlayadd">_add()_</a>
- <a href="https://github.com/Salliii/conlay#conlayprint">_print()_</a>
##### Elements
- <a href="https://github.com/Salliii/conlay#layoutelement">LayoutElement()</a>
- <a href="https://github.com/Salliii/conlay#box">Box()</a>
- <a href="https://github.com/Salliii/conlay#thinbox">ThinBox()</a>
- <a href="https://github.com/Salliii/conlay#boldbox">BoldBox()</a>
- <a href="https://github.com/Salliii/conlay#label">Label()</a>
- <a href="https://github.com/Salliii/conlay#thinlabel">ThinLabel()</a>
- <a href="https://github.com/Salliii/conlay#boldlabel">BoldLabel()</a>
- <a href="https://github.com/Salliii/conlay#input">Input()</a>
- <a href="https://github.com/Salliii/conlay#thininput">ThinInput()</a>
- <a href="https://github.com/Salliii/conlay#boldinput">BoldInput()</a>
##### Cursor & Console
- <a href="https://github.com/Salliii/conlay#cursor">Cursor</a>
- <a href="https://github.com/Salliii/conlay#cursorsetposition">_setPosition()_</a>
- <a href="https://github.com/Salliii/conlay#cursorshifthorizontal">_shiftHorizontal()_</a>
- <a href="https://github.com/Salliii/conlay#cursorshiftvertical">_shiftVertical()_</a>
- <a href="https://github.com/Salliii/conlay#cursorhide">_hide()_</a>
- <a href="https://github.com/Salliii/conlay#cursorshow">_show()_</a>
- <a href="https://github.com/Salliii/conlay#console">Console</a>
- <a href="https://github.com/Salliii/conlay#consolereset">_reset()_</a>
- <a href="https://github.com/Salliii/conlay#consoleclear">_clear()_</a>
- <a href="https://github.com/Salliii/conlay#consoleeraselinetoend">_eraseLineToEnd()_</a>
- <a href="https://github.com/Salliii/conlay#consoleeraselinefromstart">_eraseLineFromStart()_</a>
- <a href="https://github.com/Salliii/conlay#consoleeraseline">_eraseLine()_</a>
##### Coloring
- <a href="https://github.com/Salliii/conlay#color">Color</a>
- <a href="https://github.com/Salliii/conlay#colorbg">Bg</a>
- <a href="https://github.com/Salliii/conlay#colorbgrgb">_rgb()_</a>
- <a href="https://github.com/Salliii/conlay#colorfg">Fg</a>
- <a href="https://github.com/Salliii/conlay#colorfgrgb">_rgb()_</a>
##### Border & Border Types
- <a href="https://github.com/Salliii/conlay#border">Border</a>
- <a href="https://github.com/Salliii/conlay#bold">Bold</a>
- <a href="https://github.com/Salliii/conlay#thin">Thin</a>
## License
Licensed under the <a href="https://github.com/Salliii/conlay/blob/main/LICENSE">MIT License</a>.
<!-- shields -->
[shields-pypi_version]: https://img.shields.io/pypi/v/conlay?label=PyPi%20Version&style=for-the-badge
[shields-issues]: https://img.shields.io/github/issues/Salliii/conlay?style=for-the-badge
[shields-license]: https://img.shields.io/github/license/Salliii/conlay?style=for-the-badge
<!-- url -->
[url-pypi_version]: https://pypi.org/project/conlay/
[url-issues]: https://github.com/Salliii/conlay/issues
[url-license]: https://github.com/Salliii/conlay/blob/main/LICENSE
Raw data
{
"_id": null,
"home_page": "https://github.com/Salliii/conlay",
"name": "conlay",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,library,console,layout",
"author": "Salliii",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/c4/03/3f9092dfedb20dbd506ddba6cf8ce668225fa3d325a0711b4d1b4143442d/conlay-1.1.0.tar.gz",
"platform": null,
"description": "# Conlay - Console Layout\r\n[![PyPi version][shields-pypi_version]][url-pypi_version]\r\n[![Github Issues][shields-issues]][url-issues]\r\n[![Github License][shields-license]][url-license]\r\n\r\nCreate visually pleasing console layouts with this easy-to-use Python library. \r\n\r\n\r\n\r\n\r\n## Installing\r\nInstall using <a href=\"https://pip.pypa.io/en/stable/\">pip</a>\r\n\r\n```bash\r\npip install conlay\r\n```\r\n\r\nor install it from <a href=\"https://pypi.org/project/conlay/#files\">PyPi</a>\r\n\r\n\r\n\r\n\r\n## Example\r\n```python\r\nfrom conlay import *\r\n\r\nlayout = Conlay()\r\n\r\nblank_box = BoldBox(0, 0, 30, 5)\r\nlayout.add(blank_box)\r\n\r\nlabel = ThinLabel(0, 0, \"this is a test\")\r\nblank_box.add(label)\r\n\r\nlayout.print()\r\n``` \r\n\r\nConsole output:\r\n\r\n```\r\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\r\n\u2503\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e \u2503\r\n\u2503\u2502this is a test\u2502 \u2503\r\n\u2503\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f \u2503\r\n\u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251b\r\n\r\n\r\n>\r\n```\r\n\r\n\r\n\r\n\r\n## Conlay()\r\n`Conlay()` is the core class within the library. It generates and prints out the layout.\r\n\r\n```python\r\nlayout = Conlay()\r\n```\r\n\r\nThere are some attributes that can be used to modify or update the positioning, scale, color and other things. Because each <a href=\"https://github.com/Salliii/conlay#layoutelement\">LayoutElement()</a> is a subclass of `Conlay()`, each <a href=\"https://github.com/Salliii/conlay#layoutelement\">LayoutElement()</a> has the same attributes.\r\n\r\n| attribute | description | expected type | default value |\r\n| :-------- | :---------- | :------------ | :------------ |\r\n| `relative_x` | Relative x-position to the parent object | `int` | 0 |\r\n| `relative_y` | Relative y-position to the parent object | `int` | 0 |\r\n| `absolute_x` | Absolute x-position | `int` | 0 |\r\n| `absolute_y` | Absolute y-position | `int` | 0 |\r\n| `width` | Elements width | `int` | 0 |\r\n| `min_width` | Minimal width. May limit the specified with | `int` | 0 |\r\n| `max_width` | Maximal width. May limit the specified with | `int` | 0 |\r\n| `height` | Elements height | `int` | 0 |\r\n| `min_height` | Minimal height. May limit the specified with | `int` | 0 |\r\n| `max_height` | Maximal height. May limit the specified with | `int` | 0 |\r\n| `zindex` | Indicates whether an element is printed above or below other elements | `int` | 0 |\r\n| `padding_x` | Specifies the padding on the x axis, which affects the absolute position of the child elements | `int` | 0 |\r\n| `padding_y` | Specifies the padding on the y axis, which affects the absolute position of the child elements | `int` | 0 |\r\n| `text` | Specifies the text content | `str` | n/a |\r\n| `placeholder` | Specifies the placeholder content | `str` | n/a |\r\n| `content` | Stores the text content of the input element, etc. | `str` | n/a |\r\n| `background` | Specifies whether the element should have a background or not | `bool` | False |\r\n| `background_color` | Specifies the background color | <a href=\"https://github.com/Salliii/conlay#colorbg\">`Color.Bg`</a> | Color.Bg.clear |\r\n| `border_color` | Specifies the border color | <a href=\"https://github.com/Salliii/conlay#colorfg\">`Color.Fg`</a> | Color.Fg.clear |\r\n| `text_color` | Specifies the text color | <a href=\"https://github.com/Salliii/conlay#colorfg\">`Color.Fg`</a> | Color.Fg.clear |\r\n| `placeholder_color` | Specifies the placeholder color | <a href=\"https://github.com/Salliii/conlay#colorfg\">`Color.Fg`</a> | Color.Fg.rgb(150, 150, 150) |\r\n\r\n\r\n### Conlay.add()\r\nYou can use `add()` to add <a href=\"https://github.com/Salliii/conlay#layoutelement\">LayoutElements</a> to other <a href=\"https://github.com/Salliii/conlay#layoutelement\">LayoutElements</a>.\r\n\r\nSyntax:\r\n\r\n```python\r\nparent.add(child)\r\n```\r\n\r\n| argument | description | expected type |\r\n| :------- | :---------- | :------------ |\r\n| `child` | child element | <a href=\"https://github.com/Salliii/conlay#layoutelement\">LayoutElements()</a> or one of its subclasses such as <a href=\"https://github.com/Salliii/conlay#box\">Box()</a>, <a href=\"https://github.com/Salliii/conlay#label\">Label()</a>, etc. |\r\n\r\nExample:\r\n\r\n```python\r\n# add a LayoutElement to the main layout \r\nlayout = Conlay()\r\nlayout.add(ThinBox(...))\r\n\r\n# add a LayoutElement to another LayoutElement\r\nBoldBox(...).add(ThinLabel(...))\r\n```\r\n\r\n\r\n### Conlay.print()\r\nYou have to call `print()` to generate and print out the layout.\r\n\r\nSyntax:\r\n\r\n```python\r\nlayout.print()\r\n```\r\n\r\nExample:\r\n\r\n```python\r\nlayout = Conlay()\r\n...\r\nlayout.print()\r\n```\r\n\r\n\r\n\r\n\r\n## LayoutElement()\r\nThe `LayoutElement()` class serves as a superclass for all other layout elements such as <a href=\"https://github.com/Salliii/conlay#box\">Box()</a>, <a href=\"https://github.com/Salliii/conlay#label\">Label()</a>, etc.\r\n\r\nSyntax:\r\n\r\n```python\r\nelement = LayoutElement(x, y, w, h, border)\r\n```\r\n\r\n| argument | description | expected type |\r\n| :------- | :---------- | :------------ |\r\n| `x` | Relative x-position to its parent element | `int` |\r\n| `y` | Relative y-position to its parent element | `int` |\r\n| `w` | Elements width | `int` |\r\n| `h` | Elements height | `int` |\r\n| `border` | Borders character set | <a href=\"https://github.com/Salliii/conlay#border\">Border()</a> or one of its subclasses such as <a href=\"https://github.com/Salliii/conlay#bold\">Bold()</a> or <a href=\"https://github.com/Salliii/conlay#thin\">Thin()</a> |\r\n\r\nExample:\r\n\r\n```python\r\nfrom conlay import *\r\n\r\nlayout = Conlay()\r\n\r\nelement = LayoutElement(0, 0, 30, 5, Thin())\r\nlayout.add(element)\r\n\r\nlayout.print()\r\n```\r\n\r\nConsole output:\r\n\r\n```\r\n\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\r\n\u2502 \u2502\r\n\u2502 \u2502\r\n\u2502 \u2502\r\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\r\n\r\n\r\n>\r\n```\r\n\r\n\r\n\r\n\r\n## Box()\r\nThe `Box()` class is a subclass of the <a href=\"https://github.com/Salliii/conlay#layoutelement\">LayoutElement()</a> class and is used to create a simple box.\r\n\r\nSyntax:\r\n\r\n```python\r\nelement = Box(x, y, w, h, border)\r\n```\r\n\r\n| argument | description | expected type |\r\n| :------- | :---------- | :------------ |\r\n| `x` | Relative x-position to its parent element | `int` |\r\n| `y` | Relative y-position to its parent element | `int` |\r\n| `w` | Elements width | `int` |\r\n| `h` | Elements height | `int` |\r\n| `border` | Borders character set | <a href=\"https://github.com/Salliii/conlay#border\">Border()</a> or one of its subclasses such as <a href=\"https://github.com/Salliii/conlay#bold\">Bold()</a> or <a href=\"https://github.com/Salliii/conlay#thin\">Thin()</a> |\r\n\r\nExample:\r\n\r\n```python\r\nfrom conlay import *\r\n\r\nlayout = Conlay()\r\n\r\nbox = Box(0, 0, 30, 5, Thin())\r\nlayout.add(box)\r\n\r\nlayout.print()\r\n```\r\n\r\nConsole output:\r\n\r\n```\r\n\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\r\n\u2502 \u2502\r\n\u2502 \u2502\r\n\u2502 \u2502\r\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\r\n\r\n\r\n>\r\n```\r\n\r\n\r\n\r\n\r\n## ThinBox()\r\nThe `ThinBox()` class is a subclass of the <a href=\"https://github.com/Salliii/conlay#box\">Box()</a> class and is used to create a simple box with a <a href=\"https://github.com/Salliii/conlay#thin\">Thin()</a> Border.\r\n\r\nSyntax:\r\n\r\n```python\r\nelement = ThinBox(x, y, w, h)\r\n```\r\n\r\n| argument | description | expected type |\r\n| :------- | :---------- | :------------ |\r\n| `x` | Relative x-position to its parent element | `int` |\r\n| `y` | Relative y-position to its parent element | `int` |\r\n| `w` | Elements width | `int` |\r\n| `h` | Elements height | `int` |\r\n\r\nExample:\r\n\r\n```python\r\nfrom conlay import *\r\n\r\nlayout = Conlay()\r\n\r\nthinbox = ThinBox(0, 0, 30, 5)\r\nlayout.add(thinbox)\r\n\r\nlayout.print()\r\n```\r\n\r\nConsole output:\r\n\r\n```\r\n\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\r\n\u2502 \u2502\r\n\u2502 \u2502\r\n\u2502 \u2502\r\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\r\n\r\n\r\n>\r\n```\r\n\r\n\r\n\r\n\r\n## BoldBox()\r\nThe `BoldBox()` class is a subclass of the <a href=\"https://github.com/Salliii/conlay#box\">Box()</a> class and is used to create a simple box with a <a href=\"https://github.com/Salliii/conlay#bold\">Bold()</a> Border.\r\n\r\nSyntax:\r\n\r\n```python\r\nelement = BoldBox(x, y, w, h)\r\n```\r\n\r\n| argument | description | expected type |\r\n| :------- | :---------- | :------------ |\r\n| `x` | Relative x-position to its parent element | `int` |\r\n| `y` | Relative y-position to its parent element | `int` |\r\n| `w` | Elements width | `int` |\r\n| `h` | Elements height | `int` |\r\n\r\nExample:\r\n\r\n```python\r\nfrom conlay import *\r\n\r\nlayout = Conlay()\r\n\r\nboldbox = BoldBox(0, 0, 30, 5)\r\nlayout.add(boldbox)\r\n\r\nlayout.print()\r\n```\r\n\r\nConsole output:\r\n\r\n```\r\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\r\n\u2503 \u2503\r\n\u2503 \u2503\r\n\u2503 \u2503\r\n\u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251b\r\n\r\n\r\n>\r\n```\r\n\r\n\r\n\r\n\r\n## Label()\r\nThe `Label()` class is a subclass of the <a href=\"https://github.com/Salliii/conlay#layoutelement\">LayoutElement()</a> class and is used to create a simple box.\r\n\r\nSyntax:\r\n\r\n```python\r\nelement = Label(x, y, text, border)\r\n```\r\n\r\n| argument | description | expected type |\r\n| :------- | :---------- | :------------ |\r\n| `x` | Relative x-position to its parent element | `int` |\r\n| `y` | Relative y-position to its parent element | `int` |\r\n| `text` | Text content | `str` |\r\n| `border` | Borders character set | <a href=\"https://github.com/Salliii/conlay#border\">Border()</a> or one of its subclasses such as <a href=\"https://github.com/Salliii/conlay#bold\">Bold()</a> or <a href=\"https://github.com/Salliii/conlay#thin\">Thin()</a> |\r\n\r\n```python\r\nfrom conlay import *\r\n\r\nlayout = Conlay()\r\n\r\nlabel = Label(0, 0, \"this is a test\", Thin())\r\nlayout.add(label)\r\n\r\nlayout.print()\r\n```\r\n\r\nConsole output:\r\n\r\n```\r\n\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\r\n\u2502this is a test\u2502\r\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\r\n\r\n\r\n>\r\n```\r\n\r\n\r\n\r\n\r\n## ThinLabel()\r\nThe `ThinLabel()` class is a subclass of the <a href=\"https://github.com/Salliii/conlay#label\">Label()</a> class and is used to create a simple label with a <a href=\"https://github.com/Salliii/conlay#thin\">Thin()</a> Border.\r\n\r\nSyntax:\r\n\r\n```python\r\nelement = ThinLabel(x, y, text)\r\n```\r\n\r\n| argument | description | expected type |\r\n| :------- | :---------- | :------------ |\r\n| `x` | Relative x-position to its parent element | `int` |\r\n| `y` | Relative y-position to its parent element | `int` |\r\n| `text` | Text content | `str` |\r\n\r\n```python\r\nfrom conlay import *\r\n\r\nlayout = Conlay()\r\n\r\nthinlabel = ThinLabel(0, 0, \"this is a test\")\r\nlayout.add(thinlabel)\r\n\r\nlayout.print()\r\n```\r\n\r\nConsole output:\r\n\r\n```\r\n\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\r\n\u2502this is a test\u2502\r\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\r\n\r\n\r\n>\r\n```\r\n\r\n\r\n\r\n\r\n## BoldLabel()\r\nThe `BoldLabel()` class is a subclass of the <a href=\"https://github.com/Salliii/conlay#label\">Label()</a> class and is used to create a simple label with a <a href=\"https://github.com/Salliii/conlay#bold\">Bold()</a> Border.\r\n\r\nSyntax:\r\n\r\n```python\r\nelement = BoldLabel(x, y, text)\r\n```\r\n\r\n| argument | description | expected type |\r\n| :------- | :---------- | :------------ |\r\n| `x` | Relative x-position to its parent element | `int` |\r\n| `y` | Relative y-position to its parent element | `int` |\r\n| `text` | Text content | `str` |\r\n\r\n```python\r\nfrom conlay import *\r\n\r\nlayout = Conlay()\r\n\r\nboldlabel = BoldLabel(0, 0, \"this is a test\")\r\nlayout.add(boldlabel)\r\n\r\nlayout.print()\r\n```\r\n\r\nConsole output:\r\n\r\n```\r\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\r\n\u2503this is a test\u2503\r\n\u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251b\r\n\r\n\r\n>\r\n```\r\n\r\n\r\n\r\n\r\n## Input()\r\nThe `Input()` class is a subclass of the <a href=\"https://github.com/Salliii/conlay#layoutelement\">LayoutElement()</a> class and is used to create a input field.\r\n\r\nSyntax:\r\n\r\n```python\r\nelement = Input(x, y, text, length, border)\r\n```\r\n\r\n| argument | description | expected type |\r\n| :------- | :---------- | :------------ |\r\n| `x` | Relative x-position to its parent element | `int` |\r\n| `y` | Relative y-position to its parent element | `int` |\r\n| `text` | Text content | `str` |\r\n| `length` | expected input length | `int` |\r\n| `border` | Borders character set | <a href=\"https://github.com/Salliii/conlay#border\">Border()</a> or one of its subclasses such as <a href=\"https://github.com/Salliii/conlay#bold\">Bold()</a> or <a href=\"https://github.com/Salliii/conlay#thin\">Thin()</a> |\r\n\r\n```python\r\nfrom conlay import *\r\n\r\nlayout = Conlay()\r\n\r\ninput_element = Input(0, 0, \"input:\", 10, Thin())\r\nlayout.add(input_element)\r\n\r\nlayout.print()\r\n```\r\n\r\nConsole output:\r\n\r\n```\r\n\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\r\n\u2502input: \u2502\r\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\r\n\r\n\r\n>\r\n```\r\n\r\nafter you've entered a text, you can get it with the element.content variable\r\n\r\n```python\r\nfrom conlay import *\r\n\r\nlayout = Conlay()\r\n\r\ninput_element = Input(0, 0, \"input:\", 10, Thin())\r\nlayout.add(input_element)\r\n\r\nlayout.print()\r\n\r\nprint(input_element.content)\r\n```\r\n\r\n\r\n\r\n\r\n## ThinInput()\r\nThe `ThinInput()` class is a subclass of the <a href=\"https://github.com/Salliii/conlay#input\">Input()</a> class and is used to create a simple input field with a <a href=\"https://github.com/Salliii/conlay#thin\">Thin()</a> Border.\r\n\r\nSyntax:\r\n\r\n```python\r\nelement = ThinInput(x, y, text, length)\r\n```\r\n\r\n| argument | description | expected type |\r\n| :------- | :---------- | :------------ |\r\n| `x` | Relative x-position to its parent element | `int` |\r\n| `y` | Relative y-position to its parent element | `int` |\r\n| `text` | Text content | `str` |\r\n| `length` | expected input length | `int` |\r\n\r\n```python\r\nfrom conlay import *\r\n\r\nlayout = Conlay()\r\n\r\ninput_element = ThinInput(0, 0, \"input:\", 10)\r\nlayout.add(input_element)\r\n\r\nlayout.print()\r\n```\r\n\r\nConsole output:\r\n\r\n```\r\n\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\r\n\u2502input: \u2502\r\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\r\n\r\n\r\n>\r\n```\r\n\r\n\r\n\r\n\r\n## BoldInput()\r\nThe `BoldInput()` class is a subclass of the <a href=\"https://github.com/Salliii/conlay#input\">Input()</a> class and is used to create a simple input field with a <a href=\"https://github.com/Salliii/conlay#bold\">Bold()</a> Border.\r\n\r\nSyntax:\r\n\r\n```python\r\nelement = BoldInput(x, y, text, length)\r\n```\r\n\r\n| argument | description | expected type |\r\n| :------- | :---------- | :------------ |\r\n| `x` | Relative x-position to its parent element | `int` |\r\n| `y` | Relative y-position to its parent element | `int` |\r\n| `text` | Text content | `str` |\r\n| `length` | expected input length | `int` |\r\n\r\n```python\r\nfrom conlay import *\r\n\r\nlayout = Conlay()\r\n\r\ninput_element = BoldInput(0, 0, \"input:\", 10)\r\nlayout.add(input_element)\r\n\r\nlayout.print()\r\n```\r\n\r\nConsole output:\r\n\r\n```\r\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\r\n\u2503input: \u2503\r\n\u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251b\r\n\r\n\r\n>\r\n```\r\n\r\n\r\n\r\n\r\n## Cursor\r\nThe `Cursor` class provides a few functions for simple <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797\">Ansi Escape</a> cursor actions.\r\n\r\n\r\n### Cursor.setPosition()\r\nSet the cursor to a specific position. The <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797\">Ansi Escape Sequence</a> used for this command is `\\x1b[<y>;<x>H`.\r\n\r\nSyntax:\r\n\r\n```python\r\nCursor.setPosition(x, y)\r\n```\r\n\r\nExample:\r\n\r\n```python\r\nCursor.setPosition(10, 5)\r\n```\r\n\r\n\r\n### Cursor.shiftHorizontal()\r\nMove the cursor along the X axis. The <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797\">Ansi Escape Sequence</a> used for this command is `\\x1b[<x>D` and `\\x1b[<x>C`.\r\n\r\nSyntax:\r\n\r\n```python\r\nCursor.shiftHorizontal(x)\r\n```\r\n\r\nExample:\r\n\r\n```python\r\n# move the cursor 10 collumns to the right\r\nCursor.shiftHorizontal(10)\r\n\r\n# move the cursor 5 collumns to the left\r\nCursor.shiftHorizontal(-5)\r\n```\r\n\r\n\r\n### Cursor.shiftVertical()\r\nMove the cursor along the Y axis. The <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797\">Ansi Escape Sequence</a> used for this command is `\\x1b[<y>A` and `\\x1b[<y>B`.\r\n\r\nSyntax:\r\n\r\n```python\r\nCursor.shiftVertical(y)\r\n```\r\n\r\nExample:\r\n\r\n```python\r\n# move the cursor 10 collumns down\r\nCursor.shiftVertical(10)\r\n\r\n# move the cursor 5 collumns up\r\nCursor.shiftVertical(-5)\r\n```\r\n\r\n\r\n### Cursor.hide()\r\nHides the cursor. The <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797\">Ansi Escape Sequence</a> used for this command is `\\x1b[?25l`.\r\n\r\nSyntax:\r\n\r\n```python\r\nCursor.hide()\r\n```\r\n\r\n\r\n### Cursor.show()\r\nShows the cursor. The <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797\">Ansi Escape Sequence</a> used for this command is `\\x1b[?25h`.\r\n\r\nSyntax:\r\n\r\n```python\r\nCursor.show()\r\n```\r\n\r\n\r\n\r\n\r\n## Console\r\nThe `Console` class provides a few functions for simple <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797\">Ansi Escape</a> console actions.\r\n\r\n\r\n### Console.reset()\r\nThis Function resets the console. The <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797\">Ansi Escape Sequence</a> used for this command is `\\x1bc`.\r\n\r\nSyntax:\r\n\r\n```python\r\nConsole.reset()\r\n```\r\n\r\n\r\n### Console.clear()\r\nThis Function clears the console. The <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797\">Ansi Escape Sequence</a> used for this command is `\\x1b[3J`.\r\n\r\nSyntax:\r\n\r\n```python\r\nConsole.clear()\r\n```\r\n\r\n\r\n### Console.eraseLineToEnd()\r\nErase the line from the cursor position to the end. The <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797\">Ansi Escape Sequence</a> used for this command is `\\x1b[0K`.\r\n\r\nSyntax:\r\n\r\n```python\r\nConsole.eraseLineToEnd()\r\n```\r\n\r\n\r\n### Console.eraseLineFromStart()\r\nErase the line from start to the cursor position. The <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797\">Ansi Escape Sequence</a> used for this command is `\\x1b[1K`.\r\n\r\nSyntax:\r\n\r\n```python\r\nConsole.eraseLineFromStart()\r\n```\r\n\r\n\r\n### Console.eraseLine()\r\nErase the line. The <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797\">Ansi Escape Sequence</a> used for this command is `\\x1b[2K`.\r\n\r\nSyntax:\r\n\r\n```python\r\nConsole.eraseLine()\r\n```\r\n\r\n\r\n\r\n\r\n## Color\r\nThe `Color` class allows you to set the foreground and background color using the <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#color-codes\">Ansi Escape Color Codes</a>.\r\n\r\n\r\n### Color.Bg\r\nThe `Color.Bg` class provides a few predefined background <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#color-codes\">Ansi Escape Color Codes</a>.\r\n\r\n| Variable Name | rgb values | ansi escape sequence |\r\n| :------------ | :--------- | :------------------- |\r\n| Color.Bg.black | 0, 0, 0 | `\\x1b[49m` |\r\n| Color.Bg.black | 0, 0, 0 | `\\x1b[48;2;0;0;0m` |\r\n| Color.Bg.white | 255, 255, 255 | `\\x1b[48;2;255;255;255m` |\r\n| Color.Bg.red | 205, 49, 49 | `\\x1b[48;2;205;49;49m` |\r\n| Color.Bg.green | 13, 188, 121 | `\\x1b[48;2;13;188;121m` |\r\n| Color.Bg.blue | 36, 114, 200 | `\\x1b[48;2;36;114;200m` |\r\n| Color.Bg.yellow | 229, 229, 16 | `\\x1b[48;2;229;229;16m` |\r\n| Color.Bg.purple | 188, 63, 188 | `\\x1b[48;2;188;63;188m` |\r\n| Color.Bg.cyan | 17, 168, 205 | `\\x1b[48;2;17;168;205m` |\r\n\r\n\r\n### Color.Bg.rgb()\r\nThis function takes three arguments `r, g, b` and returns a customized background <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#color-codes\">Ansi Escape Color Code</a>\r\n\r\nSyntax:\r\n\r\n```python\r\nColor.Bg.rgb(r, g, b)\r\n```\r\n\r\nExample:\r\n\r\n```python\r\n>>> Color.Bg.rgb(255, 0, 100)\r\n'\\x1b[48;2;255;0;100m'\r\n```\r\n\r\n\r\n### Color.Fg\r\nThe `Color.Fg` class provides a few predefined foreground <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#color-codes\">Ansi Escape Color Codes</a>.\r\n\r\n| Variable Name | rgb values | ansi escape sequence |\r\n| :------------ | :--------- | :------------------- |\r\n| Color.Bg.black | 0, 0, 0 | `\\x1b[39m` |\r\n| Color.Fg.black | 0, 0, 0 | `\\x1b[38;2;0;0;0m` |\r\n| Color.Fg.white | 255, 255, 255 | `\\x1b[38;2;255;255;255m` |\r\n| Color.Fg.red | 205, 49, 49 | `\\x1b[38;2;205;49;49m` |\r\n| Color.Fg.green | 13, 188, 121 | `\\x1b[38;2;13;188;121m` |\r\n| Color.Fg.blue | 36, 114, 200 | `\\x1b[38;2;36;114;200m` |\r\n| Color.Fg.yellow | 229, 229, 16 | `\\x1b[38;2;229;229;16m` |\r\n| Color.Fg.purple | 188, 63, 188 | `\\x1b[38;2;188;63;188m` |\r\n| Color.Fg.cyan | 17, 168, 205 | `\\x1b[38;2;17;168;205m` |\r\n\r\n\r\n### Color.Fg.rgb()\r\nThis function takes three arguments `r, g, b` and returns a customized foreground <a href=\"https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#color-codes\">Ansi Escape Color Code</a>\r\n\r\nSyntax:\r\n\r\n```python\r\nColor.Fg.rgb(r, g, b)\r\n```\r\n\r\nExample:\r\n\r\n```python\r\n>>> Color.Fg.rgb(255, 0, 100)\r\n'\\x1b[38;2;255;0;100m'\r\n```\r\n\r\n\r\n\r\n\r\n## Border\r\nThe `Border()` class and its subclasses serve as a character set and define the required Unicode characters.\r\n\r\n| class attributes | unicode characters |\r\n| :--------------- | :----------------- |\r\n| `vertical` | n/a |\r\n| `horizontal` | n/a |\r\n| `top_left` | n/a |\r\n| `top_right` | n/a |\r\n| `bottom_left` | n/a |\r\n| `bottom_right` | n/a |\r\n\r\n\r\n\r\n\r\n## Thin()\r\nThe `Thin()` class is a subclass of <a href=\"https://github.com/Salliii/conlay#border\">Border()</a> and serves as a character set and defines the required thin Unicode characters.\r\n\r\n| class attributes | unicode characters |\r\n| :--------------- | :----------------- |\r\n| `vertical` | `\\u2503` |\r\n| `horizontal` | `\\u2501` |\r\n| `top_left` | `\\u250F` |\r\n| `top_right` | `\\u2513` |\r\n| `bottom_left` | `\\u2517` |\r\n| `bottom_right` | `\\u251B` |\r\n\r\n\r\n\r\n\r\n## Bold()\r\nThe `Bold()` class is a subclass of <a href=\"https://github.com/Salliii/conlay#border\">Border()</a> and serves as a character set and defines the required bold Unicode characters.\r\n\r\n| class attributes | unicode characters |\r\n| :--------------- | :----------------- |\r\n| `vertical` | `\\u2502` |\r\n| `horizontal` | `\\u2500` |\r\n| `top_left` | `\\u256D` |\r\n| `top_right` | `\\u256E` |\r\n| `bottom_left` | `\\u2570` |\r\n| `bottom_right` | `\\u256F` |\r\n\r\n\r\n\r\n\r\n## Summary\r\n\r\n- <a href=\"https://github.com/Salliii/conlay#conlay\">Conlay()</a>\r\n - <a href=\"https://github.com/Salliii/conlay#conlayadd\">_add()_</a>\r\n - <a href=\"https://github.com/Salliii/conlay#conlayprint\">_print()_</a>\r\n\r\n##### Elements\r\n- <a href=\"https://github.com/Salliii/conlay#layoutelement\">LayoutElement()</a>\r\n- <a href=\"https://github.com/Salliii/conlay#box\">Box()</a>\r\n- <a href=\"https://github.com/Salliii/conlay#thinbox\">ThinBox()</a>\r\n- <a href=\"https://github.com/Salliii/conlay#boldbox\">BoldBox()</a>\r\n- <a href=\"https://github.com/Salliii/conlay#label\">Label()</a>\r\n- <a href=\"https://github.com/Salliii/conlay#thinlabel\">ThinLabel()</a>\r\n- <a href=\"https://github.com/Salliii/conlay#boldlabel\">BoldLabel()</a>\r\n- <a href=\"https://github.com/Salliii/conlay#input\">Input()</a>\r\n- <a href=\"https://github.com/Salliii/conlay#thininput\">ThinInput()</a>\r\n- <a href=\"https://github.com/Salliii/conlay#boldinput\">BoldInput()</a>\r\n\r\n##### Cursor & Console\r\n- <a href=\"https://github.com/Salliii/conlay#cursor\">Cursor</a>\r\n - <a href=\"https://github.com/Salliii/conlay#cursorsetposition\">_setPosition()_</a>\r\n - <a href=\"https://github.com/Salliii/conlay#cursorshifthorizontal\">_shiftHorizontal()_</a>\r\n - <a href=\"https://github.com/Salliii/conlay#cursorshiftvertical\">_shiftVertical()_</a>\r\n - <a href=\"https://github.com/Salliii/conlay#cursorhide\">_hide()_</a>\r\n - <a href=\"https://github.com/Salliii/conlay#cursorshow\">_show()_</a>\r\n\r\n- <a href=\"https://github.com/Salliii/conlay#console\">Console</a>\r\n - <a href=\"https://github.com/Salliii/conlay#consolereset\">_reset()_</a>\r\n - <a href=\"https://github.com/Salliii/conlay#consoleclear\">_clear()_</a>\r\n - <a href=\"https://github.com/Salliii/conlay#consoleeraselinetoend\">_eraseLineToEnd()_</a>\r\n - <a href=\"https://github.com/Salliii/conlay#consoleeraselinefromstart\">_eraseLineFromStart()_</a>\r\n - <a href=\"https://github.com/Salliii/conlay#consoleeraseline\">_eraseLine()_</a>\r\n\r\n##### Coloring\r\n- <a href=\"https://github.com/Salliii/conlay#color\">Color</a>\r\n - <a href=\"https://github.com/Salliii/conlay#colorbg\">Bg</a>\r\n - <a href=\"https://github.com/Salliii/conlay#colorbgrgb\">_rgb()_</a>\r\n - <a href=\"https://github.com/Salliii/conlay#colorfg\">Fg</a>\r\n - <a href=\"https://github.com/Salliii/conlay#colorfgrgb\">_rgb()_</a>\r\n\r\n##### Border & Border Types\r\n- <a href=\"https://github.com/Salliii/conlay#border\">Border</a>\r\n- <a href=\"https://github.com/Salliii/conlay#bold\">Bold</a>\r\n- <a href=\"https://github.com/Salliii/conlay#thin\">Thin</a>\r\n\r\n\r\n## License\r\n\r\nLicensed under the <a href=\"https://github.com/Salliii/conlay/blob/main/LICENSE\">MIT License</a>.\r\n\r\n\r\n\r\n\r\n<!-- shields -->\r\n[shields-pypi_version]: https://img.shields.io/pypi/v/conlay?label=PyPi%20Version&style=for-the-badge\r\n[shields-issues]: https://img.shields.io/github/issues/Salliii/conlay?style=for-the-badge\r\n[shields-license]: https://img.shields.io/github/license/Salliii/conlay?style=for-the-badge\r\n\r\n<!-- url -->\r\n[url-pypi_version]: https://pypi.org/project/conlay/\r\n[url-issues]: https://github.com/Salliii/conlay/issues\r\n[url-license]: https://github.com/Salliii/conlay/blob/main/LICENSE\r\n",
"bugtrack_url": null,
"license": "",
"summary": "A python library for creating nice layouts in the console environment",
"version": "1.1.0",
"project_urls": {
"Homepage": "https://github.com/Salliii/conlay"
},
"split_keywords": [
"python",
"library",
"console",
"layout"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ac377c720c7d3b5a4ccd0b4be7988dce42d98b7d4a96b22530f176041c542572",
"md5": "f2362b5c89dfcce1c64fffe7d7395d79",
"sha256": "8295fe035a6a961ace362308ad260a7352bb7f4cd251c46bbc8fcf9b9956e81c"
},
"downloads": -1,
"filename": "conlay-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f2362b5c89dfcce1c64fffe7d7395d79",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8594,
"upload_time": "2023-06-18T14:19:04",
"upload_time_iso_8601": "2023-06-18T14:19:04.573918Z",
"url": "https://files.pythonhosted.org/packages/ac/37/7c720c7d3b5a4ccd0b4be7988dce42d98b7d4a96b22530f176041c542572/conlay-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c4033f9092dfedb20dbd506ddba6cf8ce668225fa3d325a0711b4d1b4143442d",
"md5": "0b967b98ebaa9bb38123170eb9bf896e",
"sha256": "f8975cffd7f4ce40f7fb1ec5fee73c423b13fc3408fb571caef498ac6e168b73"
},
"downloads": -1,
"filename": "conlay-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "0b967b98ebaa9bb38123170eb9bf896e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12165,
"upload_time": "2023-06-18T14:19:06",
"upload_time_iso_8601": "2023-06-18T14:19:06.593203Z",
"url": "https://files.pythonhosted.org/packages/c4/03/3f9092dfedb20dbd506ddba6cf8ce668225fa3d325a0711b4d1b4143442d/conlay-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-18 14:19:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Salliii",
"github_project": "conlay",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "conlay"
}