Python colorama.Fore 模块,LIGHTMAGENTA_EX 实例源码
我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用colorama.Fore.LIGHTMAGENTA_EX。
def print_after(path):
print(Fore.LIGHTBLUE_EX + "\nFolders after cleaning\n" + Fore.RESET)
for files in os.listdir(path):
print(files, sep=',\t')
print(Fore.LIGHTMAGENTA_EX + "\nCLEANED\n" + Fore.RESET)
def formatEntry(e:Entry):
R = _S.RESET_ALL
ID = R + _B.BLUE
P = R + _F.LIGHTGREEN_EX
TAG = R + _F.RED
NAME = R + _B.RED
Bd = R + _F.CYAN
PATH = R + _F.YELLOW
TITLE = R + _F.LIGHTMAGENTA_EX
AUTHORS = R + _F.MAGENTA
prefix = Bd + '| ' + R
comment = ( s + '\n' + prefix for s in e.comment.split('\n') ) if e.comment != '' else ()
return ''.join( (
Bd, '--------------------------------------------------------------------------------', R, '\n',
prefix, ID, 'ID : ', '{:>5}'.format(e.ID or ''), ' '*47, P, '{:>20}'.format(e.priority), NAME, e.name, PATH, e.pathstr(),
*( (
prefix, TITLE, e.bibtex.get('title', ''),
prefix, AUTHORS, e.bibtex.get('author',
) if e.bibtex else (
prefix, '<No Bibtex>', '\n')
), (R + ' ').join(''.join((TAG, '#', t)) for t in e.tags),
prefix, *comment ,
Bd,
))
def print_after(path):
print(Fore.LIGHTBLUE_EX + "\nAfter cleaning\n" + Fore.RESET)
for files in os.listdir(path):
print(files,end='\t')
print(Fore.LIGHTMAGENTA_EX + "\n\nCLEANED\n" + Fore.RESET)
def start_chat(spy):
from globals import current_status_message
error_message = None # variable for storing error message
print Fore.GREEN + "Authentication complete." + Fore.RESET + "\nWelcome " + spy.get_name() + "\n" + "age: ", spy.get_age(), "\nRating: ", spy.get_rating(), "\nOnline: ", spy.get_online();
# displaying menu for user
show_menu = True
while show_menu:
time.sleep(1)
menu_choices = Fore.LIGHTMAGENTA_EX + "What do you want to do ?\n" + Fore.RESET + \
Fore.LIGHTMAGENTA_EX + " 1.ADD A STATUS UPDATE \n" + Fore.RESET + \
Fore.LIGHTMAGENTA_EX + " 2.ADD A FRIEND \n" + Fore.RESET + \
Fore.LIGHTMAGENTA_EX + " 3.SEND A SECRET MESSAGE \n" + Fore.RESET + \
Fore.LIGHTMAGENTA_EX + " 4.READ A SECRET MESSAGE \n" + Fore.RESET + \
Fore.LIGHTMAGENTA_EX + " 5.READ CHATS FROM A USER \n" + Fore.RESET + \
Fore.LIGHTMAGENTA_EX + " 6.CLOSE APPLICATION \n " + Fore.RESET
result = int(raw_input(menu_choices))
# validating user's input
if result == 1:
time.sleep(1)
current_status_message = add_status(current_status_message)
time.sleep(1)
print 'your status has been updated to :\n', current_status_message
elif result == 2:
time.sleep(1)
number_of_friends = add_friend()
print 'You have %d friends' % number_of_friends
show_friends()
elif result == 3:
time.sleep(1)
send_message()
elif result == 4:
time.sleep(1)
read_message()
elif result == 5:
time.sleep(1)
read_chat_history()
elif result == 6:
show_menu = False
time.sleep(1)
print Fore.RED + "Application is closed now."
else:
print "WRONG CHOICE" # exit from application
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。