Skip to main content

PySysCmd是一个用于开发终端PY命令行的第三方库,简单,易用。

Project description

PyOSCmd


PyOSCmd是一个用于开发终端命令行的第三方库,简单,易用。

  • Color.py

STD_INPUT_HANDLE = -10
STD_OUTPUT_HANDLE= -11
STD_ERROR_HANDLE = -12
FOREGROUND_BLACK = 0x00 # black.
FOREGROUND_DARKBLUE = 0x01 # dark blue. 暗蓝色
FOREGROUND_DARKGREEN = 0x02 # dark green. 暗绿色
FOREGROUND_DARKSKYBLUE = 0x03 # dark skyblue. 暗天蓝色
FOREGROUND_DARKRED = 0x04 # dark red. 暗红色
FOREGROUND_DARKPINK = 0x05 # dark pink. 暗粉红色
FOREGROUND_DARKYELLOW = 0x06 # dark yellow. 暗黄色
FOREGROUND_DARKWHITE = 0x07 # dark white. 暗白色
FOREGROUND_DARKGRAY = 0x08 # dark gray. 暗灰色
FOREGROUND_BLUE = 0x09 # blue.
FOREGROUND_GREEN = 0x0a # green.
FOREGROUND_SKYBLUE = 0x0b # skyblue.
FOREGROUND_RED = 0x0c # red.
FOREGROUND_PINK = 0x0d # pink.
FOREGROUND_YELLOW = 0x0e # yellow.
FOREGROUND_WHITE = 0x0f # white.
BACKGROUND_BLUE = 0x10 # dark blue.
BACKGROUND_GREEN = 0x20 # dark green.
BACKGROUND_DARKSKYBLUE = 0x30 # dark skyblue.
BACKGROUND_DARKRED = 0x40 # dark red.
BACKGROUND_DARKPINK = 0x50 # dark pink.
BACKGROUND_DARKYELLOW = 0x60 # dark yellow.
BACKGROUND_DARKWHITE = 0x70 # dark white.
BACKGROUND_DARKGRAY = 0x80 # dark gray.
BACKGROUND_BLUE = 0x90 # blue.
BACKGROUND_GREEN = 0xa0 # green.
BACKGROUND_SKYBLUE = 0xb0 # skyblue.
BACKGROUND_RED = 0xc0 # red.
BACKGROUND_PINK = 0xd0 # pink.
BACKGROUND_YELLOW = 0xe0 # yellow.
BACKGROUND_WHITE = 0xf0 # white.

显示方式 效果 前景色 背景色 颜色描述
0 终端默认设置 30 40 黑色
1 高亮显示 31 41 红色
4 使用下划线 34 42 绿色
5 闪烁 33 43 黄色
7 反白显示 34 44 蓝色
8 不可见 35 45 紫红色
22 非高亮显示 36 46 青蓝色
24 去下划线 37 47 白色
25 去闪烁
27 非反白显示
28 可见

import PyOSCmd

# OutWindowsFontColor
PyOSCmd.OutWindowFontColor().Print(data="Hello PySysCmd", color=PyOSCmd.LINUX_BOLD)
# Out Hello PySysCmd

# OurLinuxFontColor
PyOSCmd.OutLinuxFontColor().Print(data="Hello Linux!", config=[1, 31, 47])
PyOSCmd.OutLinuxFontColor().Print(data="Hello Linux!", config=PyOSCmd.LINUX_WARNING)

# Out Hello Linux!
  • 使用事例
import PyOSCmd
import sys

def text():
    print("Test!")

PyOSCmd.PyOSCmd(
    {
        "-h":"--help",
        "-t":text
    },
    sys.argv[0:],
    PyOSCmd.OutWindowFontColor,
    PyOSCmd.FOREGROUND_YELLOW
)

QQ:2097632843 QQ群:706128290 mail:mc2005wj@163.com

Kuko

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyOSCmd-0.1.tar.gz (4.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page