All Projects → gojuukaze → Terminal_layout

gojuukaze / Terminal_layout

Licence: gpl-3.0
The project help you to quickly build layouts in terminal,cross-platform(一个跨平台的命令行ui布局工具)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Terminal layout

Pyinquirer
A Python module for common interactive command line user interfaces
Stars: ✭ 1,151 (+1074.49%)
Mutual labels:  command-line-tool, cli-app, cmd, cli, command-line
Forge Node App
🛠📦🎉 Generate Node.js boilerplate with optional libraries & tools
Stars: ✭ 90 (-8.16%)
Mutual labels:  command-line-tool, cli-app, cli, command-line
Git Tidy
Tidy up stale git branches.
Stars: ✭ 137 (+39.8%)
Mutual labels:  command-line-tool, cli-app, cli, command-line
Initior
A command line application that let's you initialize your new projects the right way, replaces npm and yarn's init 🎆
Stars: ✭ 17 (-82.65%)
Mutual labels:  command-line-tool, cli-app, cmd, cli
Node.cli Progress
⌛️ easy to use progress-bar for command-line/terminal applications
Stars: ✭ 466 (+375.51%)
Mutual labels:  command-line-tool, cli, command-line, progress-bar
Pypistats
Command-line interface to PyPI Stats API to get download stats for Python packages
Stars: ✭ 86 (-12.24%)
Mutual labels:  command-line-tool, cli, command-line
Terjira
Terjira is a very interactive and easy to use CLI tool for Jira.
Stars: ✭ 713 (+627.55%)
Mutual labels:  command-line-tool, cli, command-line
Sampler
Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.
Stars: ✭ 9,203 (+9290.82%)
Mutual labels:  command-line-tool, cmd, command-line
Sqlite Global Tool
SQLite .NET Core CLI tool that allows the user to manually enter and execute SQL statements with or without showing query result.
Stars: ✭ 37 (-62.24%)
Mutual labels:  command-line-tool, cmd, cli
Ripgrep
ripgrep recursively searches directories for a regex pattern while respecting your gitignore
Stars: ✭ 28,564 (+29046.94%)
Mutual labels:  command-line-tool, cli, command-line
Laminas Cli
Console command runner, exposing commands written in Laminas MVC and Mezzio components and applications
Stars: ✭ 25 (-74.49%)
Mutual labels:  command-line-tool, cli, command-line
Ed
A modern UNIX ed (line editor) clone written in Go
Stars: ✭ 44 (-55.1%)
Mutual labels:  command-line-tool, cli, command-line
Opaline
NextJS for CLI tools
Stars: ✭ 84 (-14.29%)
Mutual labels:  command-line-tool, cli, command-line
Sade
Smooth (CLI) Operator 🎶
Stars: ✭ 746 (+661.22%)
Mutual labels:  cli-app, cli, command-line
Ntutils
Various Command Line Utilities Ported to Windows NT
Stars: ✭ 58 (-40.82%)
Mutual labels:  cmd, cli, command-line
Q
q - Run SQL directly on CSV or TSV files
Stars: ✭ 8,809 (+8888.78%)
Mutual labels:  command-line-tool, cli, command-line
Ecsctl
Command-line tool for managing AWS Elastic Container Service and Projects to run on it.
Stars: ✭ 15 (-84.69%)
Mutual labels:  command-line-tool, cli, command-line
Github Files Fetcher
Download a specific folder or file from a GitHub repo through command line
Stars: ✭ 73 (-25.51%)
Mutual labels:  command-line-tool, cli, command-line
Papis
Powerful and highly extensible command-line based document and bibliography manager.
Stars: ✭ 636 (+548.98%)
Mutual labels:  command-line-tool, cli, command-line
Python Progressbar
Progressbar 2 - A progress bar for Python 2 and Python 3 - "pip install progressbar2"
Stars: ✭ 682 (+595.92%)
Mutual labels:  cli, progress, progress-bar

terminal_layout

The project help you to quickly build layouts in terminal
(这个一个命令行ui布局工具)

demo.gif

Some extensions base on terminal_layout

progress.gif

choice.gif


** video demo **

asciicast

link

install

pip install terminal-layout

Dependencies

  • Python 2.7, 3.5+ (maybe 3.4)
  • Linux, OS X, and Windows systems.

Usage

  • easy demo:
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()

  • disable auto_re_draw
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()
  • use python2 unicode
# -*- 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()

Properties

  • fore & back
TextView('','fore',fore=Fore.red)
TextView('','back',back=Back.red)
  • style
TextView('','style',style=Style.dim)
  • width
TextView('','width',width=10)
  • weight
TextView('','weight',weight=1)
  • gravity
TextView('','gravity',gravity=Gravity.left)
  • visibility
TextView('','',visibility=Visibility.visible)
  • ex_style (not support windows)
TextView('','ex_style',style=Style.ex_blink)
  • ex_fore & ex_back (not support windows)
TextView('','ex_fore',fore=Fore.ex_red_1)
TextView('','ex_back',back=Back.ex_red_1)

LICENSE

GPLv3

Thanks

  • colorama : Simple cross-platform colored terminal text in Python
  • colored : Very simple Python library for color and formatting in terminal

捐赠 / Sponsor

开源不易,如果你觉得对你有帮助,求打赏个一块两块的

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].