当前位置: 首页>>代码示例>>Python>>正文


Python pyfiglet.figlet_format方法代码示例

本文整理汇总了Python中pyfiglet.figlet_format方法的典型用法代码示例。如果您正苦于以下问题:Python pyfiglet.figlet_format方法的具体用法?Python pyfiglet.figlet_format怎么用?Python pyfiglet.figlet_format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyfiglet的用法示例。


在下文中一共展示了pyfiglet.figlet_format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_banner

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def make_banner(query):
    # Slack turns -- into an emdash; un-turn it
    query = query.replace(u"\u2014", u"--")

    ns = ARGPARSE.parse_args(query.split(" "))
    if ns.l:
        return "```{0}```".format(", ".join(FONTS))
    font = ns.font or "standard"

    if font not in FONTS:
        return "Unable to find font {0}".format(font)

    banner = pyfiglet.figlet_format(
        " ".join(ns.bannertext), font=font).rstrip()
    if not banner:
        return

    return "```{0}```".format(banner) 
开发者ID:llimllib,项目名称:limbo,代码行数:20,代码来源:banner.py

示例2: figlet

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def figlet(event):
    if event.fwd_from:
        return
    CMD_FIG = {"slant": "slant", "3D": "3-d", "5line": "5lineoblique", "alpha": "alphabet", "banner": "banner3-D", "doh": "doh", "iso": "isometric1", "letter": "letters", "allig": "alligator", "dotm": "dotmatrix", "bubble": "bubble", "bulb": "bulbhead", "digi": "digital"}
    input_str = event.pattern_match.group(1)
    if "|" in input_str:
        text, cmd = input_str.split("|", maxsplit=1)
    elif input_str is not None:
        cmd = None
        text = input_str
    else:
        await event.edit("Please add some text to figlet")
        return
    if cmd is not None:
        try:
            font = CMD_FIG[cmd]
        except KeyError:
            await event.edit("Invalid selected font.")
            return
        result = pyfiglet.figlet_format(text, font=font)
    else:
        result = pyfiglet.figlet_format(text)
    await event.respond("‌‌‎`{}`".format(result))
    await event.delete() 
开发者ID:mkaraniya,项目名称:BotHub,代码行数:26,代码来源:figlet.py

示例3: do_ascii

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def do_ascii(self, text):
		try:
			i = PIL.Image.new('RGB', (2000, 1000))
			img = PIL.ImageDraw.Draw(i)
			txt = figlet_format(text, font='starwars')
			img.text((20, 20), figlet_format(text, font='starwars'), fill=(0, 255, 0))
			text_width, text_height = img.textsize(figlet_format(text, font='starwars'))
			imgs = PIL.Image.new('RGB', (text_width + 30, text_height))
			ii = PIL.ImageDraw.Draw(imgs)
			ii.text((20, 20), figlet_format(text, font='starwars'), fill=(0, 255, 0))
			text_width, text_height = ii.textsize(figlet_format(text, font='starwars'))
			final = BytesIO()
			imgs.save(final, 'png')
			final.seek(0)
			return final, txt
		except:
			return False, False 
开发者ID:NotSoSuper,项目名称:NotSoBot,代码行数:19,代码来源:Fun.py

示例4: do_ascii

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def do_ascii(self, text):
        try:
            i = Image.new("RGB", (2000, 1000))
            img = ImageDraw.Draw(i)
            txt = figlet_format(text, font="starwars")
            img.text((20, 20), figlet_format(text, font="starwars"), fill=(0, 255, 0))
            text_width, text_height = img.textsize(figlet_format(text, font="starwars"))
            imgs = Image.new("RGB", (text_width + 30, text_height))
            ii = ImageDraw.Draw(imgs)
            ii.text((20, 20), figlet_format(text, font="starwars"), fill=(0, 255, 0))
            text_width, text_height = ii.textsize(figlet_format(text, font="starwars"))
            final = BytesIO()
            imgs.save(final, "png")
            file_size = final.tell()
            final.seek(0)
            return final, txt, file_size
        except Exception:
            return False, False 
开发者ID:TrustyJAID,项目名称:Trusty-cogs,代码行数:20,代码来源:notsobot.py

示例5: login

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def login(remote):
    token = os.path.join(dirpath, 'token.json')
    store = file.Storage(token)
    creds = store.get()
    if not creds or creds.invalid:
        client_id = os.path.join(dirpath, 'oauth.json')
        flow = client.flow_from_clientsecrets(client_id, SCOPES)
        flags = tools.argparser.parse_args(args=[])
        if remote:
            flags.noauth_local_webserver = True
        creds = tools.run_flow(flow, store, flags)
        click.secho(
            "********************** welcome to **********************", bold=True, fg='red')
        result = pyfiglet.figlet_format("Drive - CLI", font="slant")
        click.secho(result, fg='yellow')
        click.secho(
            "********************************************************", bold=True, fg='red') 
开发者ID:nurdtechie98,项目名称:drive-cli,代码行数:19,代码来源:auth.py

示例6: banner

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def banner():
    ascii_banner = pyfiglet.figlet_format("Vxscan")
    print(Bcolors.RED + ascii_banner + Bcolors.ENDC) 
开发者ID:al0ne,项目名称:Vxscan,代码行数:5,代码来源:cli_output.py

示例7: banner

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def banner():
    banner_txt = 'butian-src-domains'
    banner_art = pyfiglet.figlet_format('src-domains')
    banner_art += '# src-domains @version: {}'.format(__version__)
    print('{}{}{}'.format(Fore.CYAN, banner_art, Fore.RESET)) 
开发者ID:m4yfly,项目名称:butian-src-domains,代码行数:7,代码来源:__init__.py

示例8: print_logo

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def print_logo():
    colorama.init()
    print()
    cprint(figlet_format('OPENGENUS', font='basic'), 'yellow')
    cprint(figlet_format('MEMES', font='starwars'), 'green') 
开发者ID:OpenGenus,项目名称:memes,代码行数:7,代码来源:logo.py

示例9: test_logo

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def test_logo():
    colorama.init()
    print()
    cprint(figlet_format('TEST', font='basic'), 'red') 
开发者ID:OpenGenus,项目名称:memes,代码行数:6,代码来源:logo.py

示例10: ascii

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def ascii(self, ctx, *, msg):
        """Convert text to ascii art. Ex: [p]ascii stuff [p]help ascii for more info."""
        if ctx.invoked_subcommand is None:
            if msg:
                font = get_config_value("optional_config", "ascii_font")
                msg = str(figlet_format(msg.strip(), font=font))
                if len(msg) > 2000:
                    await ctx.send(self.bot.bot_prefix + 'Message too long, RIP.')
                else:
                    await ctx.message.delete()
                    await ctx.send(self.bot.bot_prefix + '```\n{}\n```'.format(msg))
            else:
                await ctx.send(
                               self.bot.bot_prefix + 'Please input text to convert to ascii art. Ex: ``>ascii stuff``') 
开发者ID:appu1232,项目名称:Discord-Selfbot,代码行数:16,代码来源:fun.py

示例11: font

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def font(self, ctx, *, txt: str):
        """Change font for ascii. All fonts: http://www.figlet.org/examples.html for all fonts."""
        try:
            str(figlet_format('test', font=txt))
        except (FontError, FontNotFound):
            return await ctx.send(self.bot.bot_prefix + 'Invalid font type.')
        write_config_value("optional_config", "ascii_font", txt)
        await ctx.send(self.bot.bot_prefix + 'Successfully set ascii font.') 
开发者ID:appu1232,项目名称:Discord-Selfbot,代码行数:10,代码来源:fun.py

示例12: banner

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def banner(self):
        term.clear()
        term.pos(1, 1)
        banner = pyfiglet.figlet_format("ZYDRA", font="epic").replace("\n", "\n\t\t", 7)
        cprint("\r\n\t" + "@" * 61, "blue", end="")
        cprint("\n\t\t" + banner + "\t\tAuthor : Hamed Hosseini", "blue", attrs=['bold'])
        cprint("\t" + "@" * 61 + "\n", "blue") 
开发者ID:hamedA2,项目名称:Zydra,代码行数:9,代码来源:Zydra.py

示例13: print_opener

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def print_opener() -> None:
        """
        This function draws a big GRINDER ASCII logo at startup.
        :return: None
        """
        init(strip=not stdout.isatty())
        cprint(figlet_format("GRINDER", font="cosmike"), "blue", attrs=["bold"]) 
开发者ID:sdnewhop,项目名称:grinder,代码行数:9,代码来源:asciiart.py

示例14: _ascii

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def _ascii(self, *, text):
        msg = str(figlet_format(text, font='cybermedium'))
        if msg[0] == " ":
            msg = "." + msg[1:]
        error = figlet_format('LOL, that\'s a bit too long.',
                              font='cybermedium')
        if len(msg) > 2000:
            await self.bot.say(box(error))
        else:
            await self.bot.say(box(msg)) 
开发者ID:tekulvw,项目名称:Squid-Plugins,代码行数:12,代码来源:ascii.py

示例15: setup

# 需要导入模块: import pyfiglet [as 别名]
# 或者: from pyfiglet import figlet_format [as 别名]
def setup(bot):
    if figlet_format is None:
        raise NameError("You need to run `pip3 install pyfiglet`")
    n = Ascii(bot)
    bot.add_cog(n) 
开发者ID:tekulvw,项目名称:Squid-Plugins,代码行数:7,代码来源:ascii.py


注:本文中的pyfiglet.figlet_format方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。