terminedia | Python3 library for multimedia functions | Command Line Interface library
kandi X-RAY | terminedia Summary
kandi X-RAY | terminedia Summary
This is a Python library allowing using a text-terminal as a low-resolution graphics output, along with keyboard realtime reading, and a couple utilities enough to enable using a text terminal to run simple 2D games or simply rich terminal apps. The "noveau" factor is that it uses Unicode quarter-character block combinations to effectivelly enable 1/4 character "pixels" in the terminal. It also makes use of 24bit "true" color for text, not limiting itself to the 80’s 8 color palette for the terminal. The development version allows loading image files and displaying those as colored block chars on the terminal, several terminal-font text effects, and rendering big-text, 4 or 8 characters tall, by rendering built-in fonts as images using block characters. It is designed as a library, providing a discoverable and easy to use API for drawing, and upon install a few example scripts will be imediately available as stand-alone scripts with the "terminedia-" prefix. The idea is to keep this as a lightweight install - with as little dependencies as possible.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Read events from stdin
- Scans the input stream
- Kill mouse clicks
- List all subscribed subscriptions
- Decorator to add keyword arguments to the decorated function
- Wrap a coroutine in a context
- Combine function signature and parameters
- Render the terminal
- Clear the context
- Plot a function
- Make a line between two points
- Print text
- Set foreground and background colors
- Handle key event
- Make a line
- Receive a key press event
- Resets the block at pos
- Clears the context
- Parse regular expression
- Print text at pos
- Run the game
- Set the pixel at pos
- Insert text at given position
- Main function for the terminator
- Maps text onto a given mark
- Test the ellipses
- Bezier curve
- Refresh the text plane
terminedia Key Features
terminedia Examples and Code Snippets
Community Discussions
Trending Discussions on terminedia
QUESTION
I am getting the little documented and less present in the web "BlockingIOError" when writing to the tty from a program where I need the terminal to be in "raw" mode.
Switching the terminal to raw in Unix (Linux, Mac) is the way to get lines to show
without printing a newline, and, more important, to read whatever is typed
without having to wait for the key.
Check https://stackoverflow.com/a/6599441/108205 for a reliable way to do it in Python.
However, when printing data to the raw terminal, I would, at random times, have my program terminate with a BlockingIOError
exception.
(I had even built a retry mechanism to workaround it, but sometimes it was not work-aroundable at all).
The exception shows up in some issues on github, with no assertion on how to fix it. The way to trigger it with my project is:
...ANSWER
Answered 2021-May-02 at 00:12This snippet, creating a context manager which momentarily switches the tty back to "normal" blocking mode wrapping the parts that have a lot of output fixed the issue for me:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install terminedia
You can use terminedia like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page