Modify the Terminal
Project description
Fly Console
Fly Console is build to easy manipulate the terminal xonsole in multiple aspects It is possible to change the color, clear the terminal or manipulate the position and visibility of the cursor.
With that all said, lets get into the documentations :D
Documenation
Welcome to the documentation about the fly console package c:
With this package it is possible to change the foreground and background color of the text in the terminal, write with or without line breaks, set the cursor position with different modes, show and hide the cursor or clear the console on specific parts.
Lets get right into it!
Writing to the Terminal
The most important part is writing to the terminal. This can done in two ways. Write a line without a break or write a line with a break at the end.
We can write with a break like this
from flyconsole import Console
Console.writeln('This is a test!')
Console.writeln('This is another test!')
The output will look like this
This is a test!
This is another test!
To write without a break we use
from flyconsole import Console
Console.write('This is a test!')
Console.write('This is another test!')
With the following output
This is a test!This is another test!
As we can see, there is no line break betweeen
Colors
First of all there are two ways to use colors It is possible to use just integers from 0 to 255. There are also predefined constants for the first 16 colors (0 - 15).
They can be imported as following
from flyconsole import Color
Now lets make the console colorful! To set the foreground color of the text you can just simply run
from flyconsole import Console, Color
Console.set_color(Color.RED)
But you are not limited to the foreground color. You can also only set the background color
from flyconsole import Console, Color
Console.set_color(background=Color.CYAN)
And as if that wasn't enough, you can combine these into one line
from flyconsole import Console, Color
Console.set_color(Color.RED, Color.CYAN)
This line will do the same as the two lines before.
At some point you may want to remove all Color effects. For this the following code does the job
from flyconsole import Console
Console.reset_color()
Pretty self-explanatory.
Lets hop on to the next part!
Cursor Maniplation
Before we can start there is one thing to say. The cursor module is a submodule of the console. You dont have to import it, you can just use it right away like this
from flyconsole import Console
Console.Cursor # Thats the Cursor sub module
There a nine methods for manipulation of the cursor The first is the simplest. To jump to a specific line and column just write the follwing
from flyconsole import Console
Console.Cursor.go_to(line, column)
If u want to go to the cursors home instead, you can write
from flyconsole import Console
Console.Cursor.go_home()
There are 4 methods to go relative amounts in different directions
from flyconsole import Console
# The Cursor will go one line up
Console.Cursor.go_up()
# The Cursor will go n lines up
Console.Cursor.go_up(n)
# The Cursor will go one line down
Console.Cursor.go_down()
# The Cursor will go n lines down
Console.Cursor.go_down(n)
# The Cursor will go one column to the right
Console.Cursor.go_right()
# The Cursor will go n columns to the right
Console.Cursor.go_right(n)
# The Cursor will go one column to the left
Console.Cursor.go_left()
# The Cursor will go n columns to the left
Console.Cursor.go_left(n)
As you can see, the variable n is predefined with the value 1 so you dont have to write it again and again
You can also move the cursor down n lines and then go automatically to the beginning of that line with the following code
from flyconsole import Console
# n is predifned with 1
Console.Cursor.go_down_beginning(n)
The same also for going up
from flyconsole import Console
# n is predifned with 1
Console.Cursor.go_up_beginning(n)
Last but not least, you can go to a specific column via
from flyconsole import Console
# n is predifned with 1
Console.Cursor.go_to_column(column)
This can be usefull when u go up a line and want to be on another column
Private Modes
Private modes are some console sequences that may not work on every Terminal. To manipulate the visibility of the cursor we need private modes.
The visibility can be modified with
from flyconsole import Console
Console.Cursor.Private.hide()
Console.Cursor.Private.show()
Its obvious which method does what
Clearing the Terminal
There are six methods to clear the terminal or specific parts of it.
The first one and the most common one is there to clear the whole terminal
from flyconsole import Console
Console.Clear.clear()
To clear from the cursor to the end of the terminal you can use the next snippet
from flyconsole import Console
Console.Clear.cursor_to_end()
To clear from the cursor to the beginning of the terminal you can use this
from flyconsole import Console
Console.Clear.cursor_to_start()
You can also clear from the cursor to the end or start of the current line with
from flyconsole import Console
Console.Clear.cursor_to_end_line()
Console.Clear.cursor_to_start_line()
And you can also clear the whole current line with the following
from flyconsole import Console
Console.Clear.current_line()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file flyconsole-1.1.1.tar.gz
.
File metadata
- Download URL: flyconsole-1.1.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7d0147cb6899c20f7e666cc8db7696684d9b8d6ba1ae2dad5a0014fb2d9ebf5 |
|
MD5 | 47ab971a852205e0656fd275d6ab5b2d |
|
BLAKE2b-256 | 95291a70dedc535280ff02da59192845ee97bfd65cd11dfdb1d6a11133566bd9 |
File details
Details for the file flyconsole-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: flyconsole-1.1.1-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 441a1b28656b2a3e8f693bbd4a6cb93d55be8c75f6fcb59d16075322db5604a6 |
|
MD5 | bfb3d7b77a88de71a4472138108f8494 |
|
BLAKE2b-256 | 7177300d85f0622001af571cf221ddf0e333d8a1d0cd75d8ba44d6416f9a4d96 |