本文整理汇总了Python中blessed.Terminal.italic方法的典型用法代码示例。如果您正苦于以下问题:Python Terminal.italic方法的具体用法?Python Terminal.italic怎么用?Python Terminal.italic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blessed.Terminal
的用法示例。
在下文中一共展示了Terminal.italic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: day
# 需要导入模块: from blessed import Terminal [as 别名]
# 或者: from blessed.Terminal import italic [as 别名]
def day(args, *extra, **kwargs):
parser = argparse.ArgumentParser()
parser.add_argument(
'username',
help='The MyFitnessPal username for which to delete a stored password.'
)
parser.add_argument(
'date',
nargs='?',
default=datetime.now().strftime('%Y-%m-%d'),
type=lambda datestr: dateparse(datestr).date(),
help='The date for which to display information.'
)
args = parser.parse_args(extra)
password = get_password_from_keyring_or_interactive(args.username)
client = Client(args.username, password)
day = client.get_date(args.date)
t = Terminal()
print(t.blue(args.date.strftime('%Y-%m-%d')))
for meal in day.meals:
print(t.bold(meal.name.title()))
for entry in meal.entries:
print('* {entry.name}'.format(entry=entry))
print(
t.italic_bright_black(
' {entry.nutrition_information}'.format(entry=entry)
)
)
print('')
print(t.bold("Totals"))
for key, value in day.totals.items():
print(
'{key}: {value}'.format(
key=key.title(),
value=value,
)
)
print("Water: {amount}".format(amount=day.water))
if day.notes:
print(t.italic(day.notes))