Fetch the repository succeeded.
The project help you to quickly build layouts in terminal
(这个一个命令行ui布局工具)
Some extensions base on terminal_layout
** video demo **
pip install terminal-layout
Python | terminal_layout |
---|---|
2.7 | 2.1.x |
3.5+ | 3.x |
import time
from terminal_layout import *
ctl = LayoutCtl.quick(TableLayout,
# table id: root
[
[TextView('t1', 'Hello World!', width=Width.fill, back=Back.blue)], # <- row id: root_row_0,
[TextView('t2', '', fore=Fore.magenta)], # <- row id: root_row_1,
],
)
# or layout=ctl.get_layout()
layout = ctl.find_view_by_id('root')
layout.set_width(20)
# default: auto_re_draw=True
ctl.draw()
# call delay_set_text() must be set auto_re_draw=True,
# otherwise you must start a thread to call re_draw() by yourself
ctl.find_view_by_id('t2').delay_set_text('你好,世界!', delay=0.2)
time.sleep(0.5)
row3 = TableRow.quick_init('', [TextView('t3', 'こんにちは、世界!')])
layout.add_view(row3)
# If you call draw() with auto_re_draw=True, you must stop()
ctl.stop()
import time
from terminal_layout import *
ctl = LayoutCtl.quick(TableLayout,
# table id: root
[
[TextView('t1', 'Hello World!', width=Width.fill, back=Back.blue)], # <- row id: root_row_1,
[TextView('t2', '', fore=Fore.magenta)], # <- row id: root_row_2,
],
)
layout = ctl.find_view_by_id('root')
layout.set_width(20)
ctl.draw(auto_re_draw=False)
ctl.find_view_by_id('t2').set_text('你好,世界!')
ctl.re_draw()
time.sleep(0.5)
row3 = TableRow.quick_init('', [TextView('t3', 'こんにちは、世界!')])
layout.add_view(row3)
ctl.re_draw()
# don't need call stop()
# ctl.stop()
# -*- coding: utf-8 -*-
from terminal_layout import *
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
ctl = LayoutCtl.quick(TableLayout,
[
[TextView('', u'中文,你好', back=Back.cyan, width=Width.wrap)],
[TextView('', u'中文,你好', back=Back.cyan, width=6)],
[TextView('', u'日本語,こんにちは', back=Back.cyan, width=Width.wrap)],
]
)
ctl.draw()
TextView('','fore',fore=Fore.red)
TextView('','back',back=Back.red)
TextView('','style',style=Style.dim)
TextView('','width',width=10)
TextView('','weight',weight=1)
TextView('','gravity',gravity=Gravity.left)
TextView('','',visibility=Visibility.visible)
TextView('','ex_style',style=Style.ex_blink)
TextView('','ex_fore',fore=Fore.ex_red_1)
TextView('','ex_back',back=Back.ex_red_1)
开源不易,如果你觉得对你有帮助,求打赏个一块两块的
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Activity
Community
Health
Trend
Influence
:Code submit frequency
:React/respond to issue & PR etc.
:Well-balanced team members and collaboration
:Recent popularity of project
:Star counts, download counts etc.