0

I'm writing a small application that monitors a system and prints the system data to the terminal in a loop. Although I have achieved what I want, I want to make it more smart(efficient).

The console output looks something like this:

|------------------|-----------------|-----------|
|Voltage(V)     100|Pressure(bar)   1|RPM     XXX|
|Current(A)       2|Temperature1   24|           |
|Power(W)       200|Temperature1   23|           |
|------------------|-----------------|-----------|

The only thing that keeps updating (dynamic) are the values reported by the system. The texts are static. I don't want the system to keep printing this table below one another. I also don't want to clear the screen from python each time I want to print. this creates a flickering effect on the terminal.

Is there a way to efficiently do this? like load this window when the script executes and just keep updating the values in loop?

tried flushing but this created a flickering effect and also not an efficient way to do it because the static texts are also re-printed each time which is not needed

Frost K
  • 1
  • 1
  • 1
    Does this answer your question? [Dynamic terminal printing with python](https://stackoverflow.com/questions/2122385/dynamic-terminal-printing-with-python) – Joe Aug 17 '23 at 14:55
  • Does it have to be a terminal app? – JonSG Aug 17 '23 at 16:53
  • By terminal I meant the linux terminal. The python script is run on a linux host. if that's what you're referring to, yes. – Frost K Aug 18 '23 at 06:59
  • Since you have working code, this question could also be suited for https://codereview.stackexchange.com (if you willing to move it there, please ensure that you don't have a double, e.g. think about deleting this question). – colidyre Aug 18 '23 at 13:44

0 Answers0