[英]Fullscreen terminal output (e.g. on a grid)
I am looking for a way or a library to output text to the full screen of the terminal.我正在寻找将 output 文本显示到终端全屏的方法或库。 Ideally, I want to be able to divide the full terminal screen into a grid and then be able to set the output of any cell.
理想情况下,我希望能够将整个终端屏幕划分为一个网格,然后能够设置任何单元格的 output。 In particular, I want to use this functionality to output ongoing calculation progress of several threads/process in a single screen.
特别是,我想使用这个功能来 output 在单个屏幕中持续计算多个线程/进程的进度。
I have seen a few libraries that implement TUIs or CUIs (like urwid, npyscreen, python-prompt-toolkit and curtsies) but they seem overly complicated for what I need;我见过一些实现 TUI 或 CUI 的库(如 urwid、npyscreen、python-prompt-toolkit 和 curtsies),但对于我的需要来说,它们似乎过于复杂; they implement widgets and UI controls.
他们实现了小部件和 UI 控件。 They are also geared toward a dialog-like application, ie, they take control of the program flow and the application is expected to respond to user input.
它们也适用于类似对话的应用程序,即它们控制程序流程并且应用程序应响应用户输入。
Is there a simple library out there that does what I need?那里有一个简单的库可以满足我的需要吗?
I don't know if I understood the question correctly, but would it be something like that?我不知道我是否正确理解了这个问题,但会是这样吗?
https://pypi.org/project/ebx-printbox/ https://pypi.org/project/ebx-printbox/
import ebx_printbox
from multiprocessing import Process
from time import sleep
import os
lst_ObjBox = []
lst_Process = []
# Box(Line:30, Column: 10 to Line: 40, Column: 100 - No Border, Clear Screen)
lst_ObjBox.append(ebx_printbox.pyBox(30, 10, 40, 100, False, True))
lst_ObjBox[0].create_box()
# Box(Line:10, Column: 70 to Line: 25, Column: 120 - With Border, No Clear Screen)
lst_ObjBox.append(ebx_printbox.pyBox(10, 70, 25, 120, True, False))
lst_ObjBox[1].create_box()
def multi_Box(int_Box):
for i in range(50):
lst_ObjBox[int_Box].box_print('Texto: ' + str(i) + ' - Process: ' + str(
os.getpid()) + ' Lorem ipsum dolor sit amet, ad suas sale eam, falli suavitate corrumpit an sit. Latine '
'viderer ex vis. Ex maiorum fuisset aliquando vix, in cum dicant gloriatur. Ei elit '
'argumentum cum, quod blandit an eum.')
sleep(1) # Time in seconds.
for index in range(2):
obj_Process = Process(target=multi_Box, args=(index,))
lst_Process.append(obj_Process)
obj_Process.start()
# Exit the completed processes
for obj_Process in lst_Process:
obj_Process.join()
https://asciinema.org/a/414012 https://asciinema.org/a/414012
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.