简体   繁体   English

全屏终端output(例如在网格上)

[英]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.

相关问题 如何以交互方式(例如使用终端)干预 for 循环 - How to interactively (e.g. using the terminal) intervene a for loop 如何从 for 循环 output 创建结构(例如列表)? - How to Create a structure (e.g. a list) from a for loop output? 打印到 Tkinter Window 而不是程序 output 框(例如 PyCharm) - Printing to Tkinter Window and not to the program output box (e.g. PyCharm) 如何在终端中将特定的python版本设置为默认版本,但要保留使用另一个(例如conda)作为软件包的可能性 - How to set a particular python version as default in terminal, but to keep the possibility to use another (e.g. conda) for a package 如何在 python 脚本的终端中获取存储在文件(例如 *.inp)中的多个“用户输入” - How to take multiple "user input" stored in a file (e.g., *.inp) in terminal for python script 更高级别的Python GUI工具包,例如,为TreeView / Grid传递dict - higher level Python GUI toolkit, e.g. pass dict for TreeView/Grid python:找出是否在shell中运行(例如sun grid engine queue) - python: find out if running in shell or not (e.g. sun grid engine queue) 如何绘制具有从数组中读取的颜色的例如正方形的xy网格 - how to plot a x-y grid of e.g. squares with colours read from an array 在 pipline 中定义步骤或作为 param_grid 中的步骤之间的区别,例如降维 - The difference between defining a step in pipline or as a step in param_grid, e.g. dimensionality reduction 如何在Jupyter(IPython,rpy2)中获取交互式R输出,例如进度条? - How to get interactive R output in Jupyter (IPython, rpy2), e.g. for a progress bar?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM