How to work with terminal window in mode when it is possible to operate with each cell by it coords? I dont know how this mode named, thats why I cant google it. Also, I know about this approach, but now it is interesting for me how to work with it low level.
UPD:
Ok, I read all the termios man page and some other docs, and the only thing I could say now – I still dont know how to make rotating bar somewhere in the terminal, ie by frames: – \ | / – .:(
UPD2
Oh, I suddenly found it there:
import sys
import time
f='-\\|/'
for i in range(10):
sys.stdout.write("\r{0}".format(f[i%4]))
sys.stdout.flush()
time.sleep(0.5)
So, the last question in this topic – what about any coordinates only with termios?
Subquestion[SOLVED]:
When I use curses ie the second code listing from this post – it makes my semi-transparent terminal window no-transparent, when top does not do this. How to keep it transparent?
solution: insert curses.use_default_colors() in the first string of def pbar(window):.
If you want a lower level library than
curses, you can usetermios(although I would suspect htop’s UI is written mainly with curses)The Python docs page on
termiosare minimal as the module pretty much just exposes the underlying UNIX’y termios library, so non-Python-specific docs are the main source of information, like this guide on termios, or the termios.h header (or runman termiosin a shell)Of course the challenge is translating the code into Python, but usually the translation is reasonably straight forward (the function calls are usually very similar, and the bit-swizzling/bit-masking is often identical)