Dynamic terminal printing with python -


Some applications, such as Helenzb, have a way of printing with the presence of dynamic refractioning data on the terminal, such as the top ().

Is this the best way to do this in Python? I have read on logging and cursing, but do not know what to use. I am creating a replenishment at the top if you have any other suggestions, then I am also open to them.

The easiest way is, if you only need to update one line (for example, to make a progress bar), '\ r' (carryback) and Sys.stdout: :

  Import system for import time is to use in category (10): sys.stdout.write ("\ r {0}>" format (" = "* I) sys.stdout.flush () time.sleep (0.5)  

If you need the appropriate console UI which supports the pointer to move forward, then use the module from the standard library:

  import time import curl dig pbar (Window): In I range (10): Window.Edistrict (10, 10, "[" + ("=" * i + +) "" + "(* * * (10 - i))" + "] ") Window. Refresh () Time.sleep (0.5) curses.wrapper (pbar)  

Highly recommended to use the function to call your main function, Terminal in case of this error Will take care of cleaning, so it will not be later in an unusable situation.

If you make more co-Mplex UI, you can create multiple windows for the screen, text input box and mouse support for multiple windows.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -