本文整理汇总了Python中pyfiglet.Figlet.renderText方法的典型用法代码示例。如果您正苦于以下问题:Python Figlet.renderText方法的具体用法?Python Figlet.renderText怎么用?Python Figlet.renderText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyfiglet.Figlet
的用法示例。
在下文中一共展示了Figlet.renderText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: printTitle
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
def printTitle():
# 腳本頭部
script_name = "NGINX vhost tools"
f = Figlet()
print f.renderText(script_name)
print "Author: JackLam([email protected])"
print ("-"*80)[:80]
示例2: lunch_text
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
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.'
示例3: hack
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
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 ""
示例4: run
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
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()
示例5: set_text_font
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
def set_text_font(text, font):
try:
figlet = Figlet(font=font)
except:
print('weefig: no such font: %s' % (font))
return ""
return figlet.renderText(text)
示例6: logo
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
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)))
示例7: inputAndTransform
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
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)
示例8: header
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
def header():
subprocess.call(['clear'])
f = Figlet(font='slant')
print('')
print(colored(f.renderText(COMMAND_KEYWORD), 'red', attrs=['bold']))
print('')
print('')
示例9: on_cmd
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
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)
示例10: figlet_header
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
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)
示例11: crypto_2
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
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"])
示例12: crypto_1
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
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 *"])
示例13: ascii_title
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
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))
示例14: ConsoleApp
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
class ConsoleApp(CommandLineMixins):
def __init__(self):
self.ascii = Figlet(font='standard')
self.modules = self.__get_module_dict()
def start(self):
while True:
print(self.ascii.renderText('KTANE SOLVER'))
choice = self.get_choice_or_quit(list(self.modules.keys()))
if choice is None:
break
self.cls()
print(self.ascii.renderText(choice))
self.modules[choice].run()
self.cls()
def __get_module_dict(self):
return { titleize(klass.__name__): klass() for klass in Module.__subclasses__() }
示例15: textApi
# 需要导入模块: from pyfiglet import Figlet [as 别名]
# 或者: from pyfiglet.Figlet import renderText [as 别名]
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)