• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pyfiglet.Figlet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: set_text_font

def set_text_font(text, font):
    try:
        figlet = Figlet(font=font)
    except:
        print('weefig: no such font: %s' % (font))
        return ""
    return figlet.renderText(text)
开发者ID:emmettu,项目名称:weefig,代码行数:7,代码来源:weefig.py


示例2: header

def header():
    subprocess.call(['clear'])
    f = Figlet(font='slant')
    print('')
    print(colored(f.renderText(COMMAND_KEYWORD), 'red', attrs=['bold']))
    print('')
    print('')
开发者ID:maxvitek,项目名称:footman,代码行数:7,代码来源:footman.py


示例3: logo

def logo(version):
    """Print gprMax logo, version, and licencing/copyright information.
        
    Args:
        version (str): Version number.
    """
    
    licenseinfo = """
Copyright (C) 2015: The University of Edinburgh
           Authors: Craig Warren and Antonis Giannopoulos
        
gprMax is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
                    
gprMax is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
                                    
You should have received a copy of the GNU General Public License
along with gprMax.  If not, see <http://www.gnu.org/licenses/>."""
    width = 65
    url = 'www.gprmax.com'
    print('\n{} {} {}'.format('*'*round((width - len(url))/2), url, '*'*round((width - len(url))/2)))
    gprMaxlogo = Figlet(font='standard', width=width, justify='center')
    print('{}'.format(gprMaxlogo.renderText('gprMax')))
    print('{} v{} {}'.format('*'*round((width - len(version))/2), (version), '*'*round((width - len(version))/2)))
    print(licenseinfo)
    print('\n{}\n'.format('*'*(width+3)))
开发者ID:jjohnhhartley,项目名称:gprMax,代码行数:31,代码来源:utilities.py


示例4: inputAndTransform

def inputAndTransform():
    dirPath =  os.curdir
    write = input("What do you want to write? Please input here:\n")
    f = Figlet(font='ogre') # 斜体 不slant是默认的字体 是不倾斜的
    textWrite = "```\n"+f.renderText(write)+"\n```"
    with open("codepic.txt", "w") as f:
        f.writelines(textWrite)
开发者ID:wendyltan,项目名称:localpractice,代码行数:7,代码来源:codeart.py


示例5: printTitle

def printTitle():
    # 腳本頭部
    script_name = "NGINX vhost tools"
    f = Figlet()
    print f.renderText(script_name)
    print "Author: JackLam([email protected])"
    print ("-"*80)[:80]
开发者ID:lamjack,项目名称:useful-script,代码行数:7,代码来源:vhost.py


示例6: on_cmd

 def on_cmd(self, serv, ev, command, args, helper):
     u'''%(namespace)s <text> : écrit le texte donné en figlet. Ne gère que
     les caractères ASCII.'''
     f = Figlet()
     args.insert(0, command)
     message = ' '.join(args)
     figlet_msg = {}
     figlet_width = 0
     for c in message:
         figlet_c = f.renderText(c).split('\n')
         added_width = max(len(fc) for fc in figlet_c)
         # adding this character will make a too long line
         if figlet_width + added_width > self.width:
             # flush figlet message
             self.privfigletmsg(serv, helper['target'], figlet_msg)
             figlet_msg = {}
             figlet_width = 0
         # adding the character
         l = 0
         for fc in figlet_c:
             figlet_msg[l] = figlet_msg.get(l, '') + fc
             l += 1
         figlet_width += added_width
     # flush figlet message
     self.privfigletmsg(serv, helper['target'], figlet_msg)
开发者ID:gordonzola,项目名称:naobot,代码行数:25,代码来源:figlet.py


示例7: figlet_header

def figlet_header(text, font='colossal', smushMode=None):
    """
    Prints text with ascii print driver.
    See available fonts with Figlet().getFonts()
    or pyfiglet.FigletFont.getFonts()
    Easy-to-read fonts include:
    * Doh       (very big)
    * Banner3   (Exclusively using '#')
    * Block     (rather subtil)
    * Colossal  (Easy to read, but set smushMode to 64 or lower for headers)
    * Georgia11 (Very elegant)
    * Roman
    * Univers
    """
    if Figlet is None:
        logger.warning("pyfiglet module not available.")
        return
    ## TODO: Add labfluence settings option to change font, etc.
    f = Figlet(font=font)
    if smushMode is not None:
        # pyfiglet default smushMode is calculated by pyfiglet.FigletFont.loadFont()
        # For some, e.g. colossal, the resulting smushMode of 128 smushes the characters a bit too much.
        # I've made a fork of pyfiglet where you can adjust smushMode directly
        # when instantiating a Figlet via argument fontkwargs.
        f.Font.smushMode = smushMode
    return f.renderText(text)
开发者ID:scholer,项目名称:labfluence,代码行数:26,代码来源:utils.py


示例8: crypto_2

def crypto_2():
    f = Figlet(font='slant')
    print(f.renderText("Compression Session"))
    wrap_input("""Crypto 2 - Compression Session""")
    wrap_input("""NOTE: you may have to adjust the HOST and PORT in the script
that is about to be run if you are not using the default.""")
    wrap_shell_command(["./crypto_02.py"])
开发者ID:eqyiel,项目名称:comp3781,代码行数:7,代码来源:scripts.py


示例9: crypto_1

def crypto_1():
    f = Figlet(font='slant')
    print(f.renderText("Standard Galactic Alphabet"))
    wrap_input("""Crypto 1 - Standard Galactic Alphabet""")
    wrap_input("""NOTE: you may have to adjust the HOST and PORT in the script
that is about to be run if you are not using the default.""")
    wrap_shell_command(["./crypto_01.py", "cat *"])
开发者ID:eqyiel,项目名称:comp3781,代码行数:7,代码来源:scripts.py


示例10: ascii_title

def ascii_title():
    with term.location(0, 0):
        title_text = "Last  Layer  Algorithm  Trainer"
        f = Figlet(font="small", width=term.width)
        print(term.white(f.renderText(title_text)))
    with term.location(0, 5):
        print("─" * term.width)
    print(term.move_y(6))
开发者ID:jbwincek,项目名称:Llat,代码行数:8,代码来源:trainer.py


示例11: lunch_text

def lunch_text():
    _version = pkg_resources.require("lunch")[0].version
    f = Figlet(font='smkeyboard')

    print f.renderText('LUNCH')
    print 'Lunch doesn\'t really do much of anything.'
    print 'Version ' + _version
    print 'Run lunch --help for a lacking list of arguments.'
开发者ID:rclarkburns,项目名称:lunch,代码行数:8,代码来源:welcome.py


示例12: textApi

def textApi(text=None):
    user_requested_font = request.args.get('font')
    font = getFont(user_requested_font)

    text = text or "Send us text!"
    fig = Figlet(font=font)
    ansi = fig.renderText(text)

    return format_request(ansi)
开发者ID:tarrant,项目名称:funtext,代码行数:9,代码来源:main.py


示例13: time_now

def time_now():
  '''
  Return current time in Figlet format.
  '''
  time_heading = '===============Time===============\n'
  now = datetime.datetime.now().strftime("%H:%M")
  f = Figlet(font='doom')
  time_details = f.renderText(now).rstrip() + '\n'
  return (time_heading + time_details).decode('utf-8')
开发者ID:bobbybabra,项目名称:twent,代码行数:9,代码来源:twent.py


示例14: startupMessage

 def startupMessage(self):
     '''
     Spiffy looking startup banner.'
     '''
     figlet = Figlet(font='slant')
     for line in figlet.renderText('sevcol IO\ngateway').splitlines():
         self.log.info(line)
     
     self.log.info('Version %s' % VERSION)
开发者ID:Sevcol,项目名称:IOgateway,代码行数:9,代码来源:gatewayMain.py


示例15: main

def main():
    parser = OptionParser(version=__version__)

    parser.add_option('-s', '--show', action='store_true', default=False,
                      help='pause at each failure and compare output '
                           '(default: %default)')

    opts, args = parser.parse_args()

    f = Figlet()

    ok = 0
    fail = 0
    failed = []
    skip = ['runic'] # known bug..

    for font in f.getFonts():
        if font in skip: continue

        f.setFont(font=font)

        outputPyfiglet = f.renderText('foo')

        fontpath = os.path.join('pyfiglet', 'fonts', font)
        if os.path.isfile(fontpath + '.flf'):
            cmd = ('figlet', '-d', 'pyfiglet/fonts', '-f', font, 'foo')
        elif os.path.isfile(fontpath + '.tlf'):
            cmd = ('toilet', '-d', 'pyfiglet/fonts', '-f', font, 'foo')
        else:
            raise Exception('Missing font file: '+fontpath)

        p = Popen(cmd, bufsize=1,stdout=PIPE)
        outputFiglet = p.communicate()[0].decode('ascii', 'replace')

        if outputPyfiglet == outputFiglet:
            print('[OK] %s' % font)
            ok += 1
            continue

        print('[FAIL] %s' % font)
        fail += 1
        failed.append(font)

        if opts.show is True:
            print('[PYTHON] *** %s\n\n' % font)
            dump(outputPyfiglet)
            print('[FIGLET] *** %s\n\n' % font)
            dump(outputFiglet)
            raw_input()

    print('OK = %d, FAIL = %d' % (ok, fail))
    if len(failed) > 0:
        print('FAILED = %s' % repr(failed))

    return 0
开发者ID:Mondego,项目名称:pyreco,代码行数:55,代码来源:allPythonContent.py


示例16: greeting

 def greeting(self):
     try:
         data = self.driver.find_element_by_xpath("//*[contains(text(), 'Logout')]")
         f = Figlet(font="slant")
         self.name = re.search("\((.*?)\)", data.text).group(
             1
         )  # Extracts username from 'Logout (username)' fetched from the page.
         print(f.renderText(self.name))
         self.name = self.name.lower()
     except NoSuchElementException:
         pass
开发者ID:vdedyukhin,项目名称:FBTools,代码行数:11,代码来源:FBTools.py


示例17: get_figlet_text

def get_figlet_text(text):
    """ Returns a big "ascii art"-like text spelling the words in text. """
    font = 'colossal' # This is case *sensitive* (on *nix and if pyfiglet is zipped).
    try:
        printer = Figlet(font)
    except NameError:
        print("ERROR, could not import pyfiglet, big text not available.")
        print("sys.path=", sys.path)
        return text
    printer.Font.smushMode = 64
    return printer.renderText(text)
开发者ID:scholer,项目名称:Mediawiker,代码行数:11,代码来源:other_utils.py


示例18: hack

    def hack(self):
        os.system("cls")
        h = Figlet(font="cybermedium")
        print h.renderText("Hacker Routine")

        target = raw_input("Select a target: ").lower()

        routine = Routine(target)
        time.sleep(0.7)
        routine.main()
        print ""
开发者ID:darthmars97,项目名称:hacker,代码行数:11,代码来源:desktop.py


示例19: run

 def run(self):
     msg = 'Initializing framework v' + str(__version__)
     print '[+]', msg
     self.log.info(msg)
     f = Figlet(font='doom')
     print f.renderText('Framework')
     self.log.debug('System ' + sys.platform)
     self.log.debug('Version ' + sys.version)
     if not os.path.exists(self.output):
         os.makedirs(self.output)
     self._list_files()
     self._run_plugins()
开发者ID:Dhiraj3005,项目名称:Learning-Python-for-Forensics,代码行数:12,代码来源:framework.py


示例20: print_rolled

def print_rolled(dice):
    holds = [' {} ']*len(dice)
    for d in range(len(dice)):
        if is_held(dice[d]):
            holds[d] = holds[d].format('held')
    f = Figlet(font='future_8')
    dies = f.renderText(' '.join(map(str,dice)))
    labels = ('  ({})  ' + '   ')*len(dice)
    hint = get_choice(dice)
    score = score_dice(hint)
    clear()
    print rolled.format(labels.format(*range(1,len(dice)+1)),dies,holds,hint,score)
开发者ID:tzp-software,项目名称:ten-thousand,代码行数:12,代码来源:screens.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyfirmata.Arduino类代码示例发布时间:2022-05-25
下一篇:
Python pyfiglet.figlet_format函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap