Python colorama 模块,Back() 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用colorama.Back()

项目:CManager    作者:fachrioktavian    | 项目源码 | 文件源码
def show_help(self):
        help = 'dashboard section:\n'
        help += ' show interfaces          : Print all interfaces found by cmanager\n'
        help += ' wizard wifi              : Go to wifi wizard section\n'
        help += ' exit                     : Exit cmanager\n\n'
        help += 'wifi-wizard section:\n'
        help += ' show profile             : List profile that saved by cmanager\n'
        help += ' show options             : List available options used to create a profile\n'
        help += ' set [options] [value]    : Set value to available options before save the profile\n'
        help += ' save profile             : Save profile after options data\'s been filled\n'
        help += ' del profile [profile]    : Del profile by profile\'s name\n'
        help += ' use [wireless_intarface] : Use this command BEFORE scanning available network or connecting a profile\n'
        help += ' scan                     : Scanning available networks\n'
        help += ' connect [profile]        : Connecting wireless interface to a wifi network using specified profile\'s name\n'
        help += ' back                     : Back to dashboard section'

        print (Fore.GREEN + Style.BRIGHT + help)
项目:OpenMDAO    作者:OpenMDAO    | 项目源码 | 文件源码
def _get_color_printer(stream=sys.stdout, colors=True):
    """
    Return a print function tied to a particular stream, along with coloring info.
    """
    try:
        from colorama import init, Fore, Back, Style
        init(autoreset=True)
    except ImportError:
        Fore = Back = Style = _NoColor()

    if not colors:
        Fore = Back = Style = _NoColor()

    def color_print(s, fore='', color='', end=''):
        """
        """
        print(color + s, file=stream, end='')
        print(Style.RESET_ALL, file=stream, end='')
        print(end=end)

    return color_print, Fore, Back, Style
项目:ggmt    作者:Granitosaurus    | 项目源码 | 文件源码
def print_match(match, template):
    """wrapper to inject colorama colors to template"""
    click.echo(template.render(match, Fore=Fore, Back=Back))
项目:grako    作者:apalala    | 项目源码 | 文件源码
def init():
    try:
        import colorama

        global Fore, Back, Style
        Fore = colorama.Fore
        Back = colorama.Back
        Style = colorama.Style
        colorama.Fore
    except ImportError:
        pass