python生日快乐代码
效果图演示
送npy的
可以自己更改颜色,文字内容,加入自己的设计。
步骤
项目目录
HappyBirthday
—PyBirthdayWish.py
—config.py
—arts/art.py/
——–example.py
——–art.py
——–artwithstars.py
1.配置好需要用的python包,都很简单,缺少的包直接用命令pip就可以。
2.编辑arts/art.py
文件,并使用颜色代码添加文本和颜色。
arts是项目中的文件夹,里面有下面三个文件。
art.py如下
# This is an example of adding colors with color codes. Add colors you wish in 'art.py' and make sure to make ```artFile = art.py``` in config.py to use art.py
mainArt = \
'''
®❤ ★ ❤ ❤ ❤ ❤ *
® * ® ❤ ✺
④ _..._ ,s$$$s. ⑤ _..._ ,s$$$s.
④ .$$$$$$$s$$ss$$$$, ® ❤ ❤ ⑤ .$$$$$$$s$$ss$$$$,
④ $$$sss$$$$s$$$$$$$ ⑤ $$$sss$$$$s$$$$$$$
④ $$ss$$$$$$$$$$$$$$ ( ) ⑤ $$ss$$$$$$$$$$$$$$
® ❤ ④ '$$$s$$$$$$$$$$$$' ® ❣ ) (⑨*⑩) (⑨*⑩) ( ⑤ '$$$s$$$$$$$$$$$$'
④ '$$$$$$$$$$$$$$' (⑨*⑩) | | (⑨*⑩) ®❣ ⑤ '$$$$$$$$$$$$$$'
④ S$$$$$$$$$$$' | ⑤|~| ④|~| ②| ⑤ S$$$$$$$$$$$'
®❤ ④ '$$$$$$$$$' ③|~| ⑤| | ④| | ⑥|~| ⑤ '$$$$$$$$$' ® *
④ '$$$$$' ® ★ ✺ ③| | ⑤| | ④| | ⑥| | ®❤ ⑤ '$$$$$'
④ '$$$' ⑧,③| |⑧a@@@@⑤| |⑧@@@@@@@@@@@④| |⑧@@@@a⑥| |⑧. ⑤ '$$$'
④ ; ⑧.,a@@@③| |⑧@@@@@⑤| |⑧@@@@@@@@@@@④| |⑧@@@@@⑥| |⑧@@@@a,. ⑤ ;
®❤ ④ ; ⑧,a@@@@@@③| |⑧@@@@@@@@@@@@.@@@@@@@@@@@@@@⑥| |⑧@@@@@@@a, ® ❤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⑦`%%%%%%%%%%%%%%%%%,,,,,,,%%%%%%%%%%%%%%%,,,,,,,%%%%%%%%%%%%%%%%%%%%'
⑦`%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
®★ ⑦`%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
®❤ ★ ⑦""""""""""""""`,,,,,,,,,'""""""""""""""""" ® ✺
②`%%%%%%%'
②`%%%%%' ® * ❤
®✺ ②%%%
® ❤ * ②%%%%% ® ★ ® ❤ *
②.,%%%%%%%,.
②,%%%%%%%%%%%%%%%%%%%, ® ❤
⑧ __ __ ____ ____ ____ __ __ ____ ____ ____ ______ __ __ ___ ____ __ __
⑧| | | / || \| \| | | | \ | || \| || | || \ / || | |
★ ⑧| | || o || o ) o ) | | | o ) | | | D ) || | || \ | o || | | ® ❤
⑧| _ || || _/| _/| ~ | | | | | | /|_| |_|| _ || D || || ~ |
⑧| | || _ || | | | |___, | | O | | | | \ | | | | || || _ ||___, |
⑧| | || | || | | | | | | | | | | . \ | | | | || || | || |
❣ ⑧|__|__||__|__||__| |__| |____/ |_____||____||__|\_| |__| |__|__||_____||__|__||____/ ® *
④ __,,,__ ⑧ ____ ____ ___ ___ ___ ④ __,,,__
✺ ④ ❤ ,-""-,-" "-,-""-, ⑧ | \ / || | | / _] ④ ,-""-,-" "-,-""-, ® ❤
★ ④ /,-' , .-'-.7.-'-. , '-,\ ⑧ | _ || o || _ _ | / [_ ④ /,-' , .-'-.7.-'-. , '-,\\
④ \( / _ _ \ )/ ⑧ | | || || \_/ || _] ④ \( / _ _ \ )/ ❤
④ '-, { (⑨0⑩) (⑨0⑩) } ,-'⑧ | | || _ || | || [_④ '-, { (⑨0⑩) (⑨0⑩) } ,-'
④ / > .---. < \ ⑧ | | || | || | || | ④ / > .---. < \\
④ ❤ |/ .-' \___/ '-. \| ⑧ |__|__||__|__||___|___||_____| ④ |/ .-' \___/ '-. \| ® ❤
❤ ④ {, / ,_ _, \ ,} ④ {, / ,_ _, \ ,}
④ \ {, \ / ,} / ④ \ {, \ / ,} / ® ❤
④ ',\. '---' ./,' ® * ② ④ ',\. '---' ./,'
② _.-""""""-._ _.-""""""-._ ② _.-""""""-._ _.-""""""-._
② .' `._.` '. ® ★ ② .' `._.` '.
®✺ ④ _②/④_ ② \ ④ _②/④_ ② \\ ® ★
④ .'` `\ ② \ ④ .'` `\ ② \\
④ / | ⑦ gxy ② ; ④ / | ⑦ ymx ② ;
④ | / ② | ④ | / ② |
④ \\ ;'---' ⑦ gxy ② ; ® ✺ ④ \\;'---' ⑦ ymx ② ; ® ❣
④ '. ; ④ _② ; ④ '. ; ④_② ;
® ★ ④ `-②\ ⑦ gxy ④ [].' `, ④ `-②\ ⑦ ymx ④[].' `,
② `\ ④ | \\ ② `\ ④| \\
② \ ④ \ | ❤ ② ❤ \ ④\ |
② `\ ④ /` _/ ® ★ ② `\ ④/` _/ ® ❤
④ ,-""-. .'②`\ /④`-,-'` .-""-, ④ ,-""-. .'②`\ /④`-,-'` .-""-,
④ / `\.' ② `\ /`④ './` \\ ④ / `\.' ② `\ /` ④'./` \\
④ ; .--. \ ② '\ /' ④ / .--. ; ④ ; .--. \ ② '\ /' ④/ .--. ;
④ ❤ | ( \ |, ② '\ /' ④ | / ) | ④ | ( \ |, ② '\ /' ④ | / ) |
④ \ ; } ;②\ /; ④ ` { ; / ®✺ ④ \ ; } ;②\ /; ④ ④` { ; /
④ `;\ \ _.-' ② \ / ④`-._ / /;` ④ `;\ \ _.-' ② \ / ④`-._ / /;`
®* ④ \ \__.' _.-' ② Y ④ `-._ '.__// ④ \ \__.' _.-' ② Y ④ `-._ '.__//
④ '.___,.-' `-.,___.' ④ '.___,.-' `-.,___.'
®★ ❤
❤ ⑦ : . ⑧ __________________ __________________ ⑦ : .
❤ ⑦ [""] ⑧ .-/| \ / |\-. ⑦ [""] ✺ ❣
⑦ | | ⑤ |⑧||| | |||⑤| ⑦ | |
★ ⑦ | | ⑤ |⑧||| | ~~*~~⑧ |||⑤| ⑦ | |
⑦ | | ⑤ |⑧||| ⑤--==*==--⑧ | |||⑤| ⑦ | | ® ❤
④ : ⑦ .'--`. ⑤ |⑧||| ⑤ 生日快乐 ⑧ | |||⑤| ⑦ .'--`. ④ :
❣ ④ : .: ⑦ /`.__.'\ ⑤ |⑧||| ⑤ 愿: ⑧ | |||⑤| ⑦ /`.__.'\ ④ : .: ® ✺
④ : . ⑦ / \ ⑤ |⑧||| ⑤每一岁都能奔走在 ⑧ | ⑤--==*==--⑧ |||⑤| ⑦ / \ ④ : .
③ ( ④ ,-'``'-.⑦ ; ; ⑤ |⑧||| ⑤ 自己的热爱里! ⑧ | ⑤ 生而自由 ⑧ |||⑤| ⑦ ; ; ④,-'``'-. ⑥ (
③ )\ ④ |`-..-'|⑦ | ,--. | ⑤ |⑧||| | ⑤ 爱而无畏 ⑧ |||⑤| ⑦ | ,--. | ④|`-..-'| ⑥ )\\
③ / ) ④| . :| ⑦|_.','`.`._| ⑤ |⑧||| | ⑤ 让自己快乐快乐 ⑧ |||⑤| ⑦ |_.','`.`._| ④| . :| ⑥ / )
③ ( ⑨*⑩ ③(④ | . : | ⑦|--' `--| ⑤ |⑧||| | ⑤ 才是目的 ⑧ |||⑤|⑦ |--' `--| ④| . : | ⑥( ⑨*⑩ (
③ \ #/ ④|`-..-'| ⑦|| | | | | ⑤ |⑧|||__________________ | _ ___|||⑤| ⑦|| | | | | ④|`-..-'| ⑥ \#/
③ .-"#'-. ④\::::::/ ⑦||)|/|)|)|\| ⑤ |⑧|/===================\|/===================\|⑤| ⑦||)|/|)|)|\| ④\::::::/⑥ .-"#'-.
★ ③ |"-.-"|⑤--④`::::'⑤--⑦|._ ~**~ _.|⑤------`--------------------~___~-------------------''------⑦|._ ~**~ _.|⑤--④`::::'⑤--⑥|"-.-"|
③ | | ④ )( ⑦ | `-..-' | ® ⑦ | `-..-' | ④)( ⑥| |
③ | | ④ )( ⑦ | | ® * ★ ⑦ | | ④)( ⑥| |
③ | |④ ,-')('-. ⑦| | ⑦ | | ④,-')('-. ⑥| | ® ❤
③ | |④( ' ` )⑦`-._ _.-' ® ★ ⑦ `-._ _.-'④( ' ` )⑥| |
③ '-._,-'④ `-....-' ⑦ ```` ® ❤ ❤ ⑦ ```` ④ `-....-' ⑥'-._,-'
®
® ✺ ❣ ✺ ❣ ★
'''
artwithstars.py
# This is uncolored art. Use the color code to decorate the art as shown in example.py
# Color Codes
'''
Copy these codes and paste it before the text for the color your wish
① = grey
② = red
③ = green
④ = yellow
⑤ = blue
⑥ = magenta
⑦ = cyan
⑧ = white
⑨ = blink
⑩ = remove blink
® = random
'''
# Happy Birthday Love
'''
https://patorjk.com/software/taag/#p=display&f=Crawford2&t=Happy%20Birthday%0A%20%20%20%20%20%20Name
Go to the above link and generate art to replace 'Happy Birthday Love' with other text you wish to display.
'''
mainArt = \
'''
❤ ★ ❤ ❤ ❤ ❤ ❤
* ❤ ✺
_..._ ,s$$$s. _..._ ,s$$$s.
.$$$$$$$s$$ss$$$$, ❤ .$$$$$$$s$$ss$$$$,
$$$sss$$$$s$$$$$$$ ❤ $$$sss$$$$s$$$$$$$ ❤
$$ss$$$$$$$$$$$$$$ ( ) $$ss$$$$$$$$$$$$$$
'$$$s$$$$$$$$$$$$' ) (*) (*) ( '$$$s$$$$$$$$$$$$'
❤ '$$$$$$$$$$$$$$' ❣ (*) | | (*) ❤ '$$$$$$$$$$$$$$' ❤
S$$$$$$$$$$$' | |~| |~| | S$$$$$$$$$$$'
'$$$$$$$$$' |~| | | | | |~| '$$$$$$$$$'
'$$$$$' | | | | | | | | '$$$$$'
'$$$' ✺ ,| |a@@@@| |@@@@@@@@@@@| |@@@@a| |. * '$$$'
; .,a@@@| |@@@@@| |@@@@@@@@@@@| |@@@@@| |@@@@a,. ;
; ,a@@@@@@| |@@@@@@@@@@@@.@@@@@@@@@@@@@@| |@@@@@@@a, ; ✺
★ ❤ ; ★ a@@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,.
❤ ,%%%%%%%%%%%%%%%%%%%,
__ __ ____ ____ ____ __ __ ____ ____ ____ ______ __ __ ___ ____ __ __
| | | / || \| \| | | | \ | || \| || | || \ / || | | ❤
❣ | | || o || o ) o ) | | | o ) | | | D ) || | || \ | o || | |
| _ || || _/| _/| ~ | | | | | | /|_| |_|| _ || D || || ~ |
| | || _ || | | | |___, | | O | | | | \ | | | | || || _ ||___, | ✺
| | || | || | | | | | | | | | | . \ | | | | || || | || |
★ |__|__||__|__||__| |__| |____/ |_____||____||__|\_| |__| |__|__||_____||__|__||____/ ❤
__,,,__ _ ___ __ __ ___ __,,,__
✺ ,-""-,-" "-,-""-, | | / \ | | | / _] ,-""-,-" "-,-""-,
/,-' , .-'-.7.-'-. , '-,\ | | | || | | / [_ /,-' , .-'-.7.-'-. , '-,\\ * ❤
\( / _ _ \ )/ | |___ | O || | || _] \( / _ _ \ )/
'-, { (0) (0) } ,-' | || || : || [_ '-, { (0) (0) } ,-'
❤ / > .---. < \ | || | \ / | | / > .---. < \\
|/ .-' \___/ '-. \| |_____| \___/ \_/ |_____| |/ .-' \___/ '-. \|
❣ {, / ,_ _, \ ,} {, / ,_ _, \ ,} ❤
\ {, \ / ,} / \ {, \ / ,} /
',\. '---' ./,' ',\. '---' ./,'
_.-""""""-._ _.-""""""-._ ❤ _.-""""""-._ _.-""""""-._
.' `._.` '. .' `._.` '. ❤
_/_ \ ❣ _/_ \\
★ .'` `\ \ .'` `\ \\
/ | Your ; / | Your ;
| / | | / | ❤ *
\\ ;'---' text ; ❤ \\;'---' text ;
'. ; _ ; '. ; _ ;
`-\ here [].' `, ✺ `-\ here [].' `,
❤ `\ | \\ `\ | \\
\ \ | ❤ \ \ |
`\ /` _/ `\ /` _/ ❤
,-""-. .'`\ /`-,-'` .-""-, * ,-""-. .'`\ /`-,-'` .-""-,
/ `\.' `\ /` './` \\ / `\.' `\ /` './` \\
; .--. \ '\ /' / .--. ; ; .--. \ '\ /' / .--. ;
| ( \ |, '\ /' | / ) | | ( \ |, '\ /' | / ) |
\ ; } ;\ /; ` { ; / ❤ \ ; } ;\ /; ` { ; /
`;\ \ _.-' \ / `-._ / /;` `;\ \ _.-' \ / `-._ / /;`
✺ \ \__.' _.-' Y `-._ '.__// \ \__.' _.-' Y `-._ '.__//
'.___,.-' `-.,___.' ★ ❤ '.___,.-' ❤ `-.,___.' ❣
❤
: . __________________ __________________ : . *
❤ [""] .-/| \ / |\-. [""] ❤
❤ | | |||| | |||| | |
| | |||| | ~~*~~ |||| | |
| | |||| --==*==-- | |||| | | ★
: .'--`. |||| -clear------this- | |||| .'--`. :
❤ : .: /`.__.'\ |||| -------and------- | |||| /`.__.'\ : .:
: . / \ |||| -enter------your- | --==*==-- |||| / \ : . *
( ,-'``'-. ; ; |||| -------text------ | -clear------this- |||| ; ; ,-'``'-. (
)\ |`-..-'| | ,--. | |||| | -------and------- |||| | ,--. | |`-..-'| )\\ ❤
/ ) | . :| |_.','`.`._| |||| | -enter------your- |||| |_.','`.`._| | . :| / )
❤ ( * ( | . : | |--' `--| |||| | -------text------ |||| |--' `--| | . : | ( * (
\ #/ |`-..-'| || | | | | ||||__________________ | _ ___|||| || | | | | |`-..-'| \#/ ❤
.-"#'-. \::::::/ ||)|/|)|)|\| ||/===================\|/===================\|| ||)|/|)|)|\| \::::::/ .-"#'-.
|"-.-"|--`::::'--|._ ~**~ _.|------`--------------------~___~-------------------''------|._ ~**~ _.|--`::::'--|"-.-"|
| | )( | `-..-' | | `-..-' | )( | |
★ | | )( | | | | )( | | ❤
| | ,-')('-. | | * ❤ ❤ | | ,-')('-. | |
| |( ' ` )`-._ _.-' `-._ _.-'( ' ` )| |
'-._,-' `-....-' ```` ❣ ★ ```` `-....-' '-._,-'
❤ ★ ✺ ❤ ✺ * ❤
'''
3.编辑config.py
文件以更改设置,并使artFile = 'art'
使用arts/art.py
而不是example.py
config.py如下
# Specify which file (without .py extension) in the arts folder should be used
artFile = "art"
# Speed of art
speed = 0.005
# Print code in the beginning
codePrint = False
codingSpeed = 0.01
codeColor='red'
# Audio
playAudio = True
audio = 'HappyBirthday.mp3'
# Random color is choosen from the list
color = ['red','green','yellow','blue','magenta','cyan','white']
# Change the keys of the dict to change the color codes
# If you change the color codes for blink, remove blink(none) and random, you have to change it in pprint() function of PyBirthdayWish.py too.
colorCodes = {'①':'grey','②':'red','③':'green','④':'yellow','⑤':'blue','⑥':'magenta','⑦':'cyan','⑧':'white','⑨':'blink','⑩':'none','®':'random'}
example.py如下
# This is an example of adding colors with color codes. Add colors you wish in 'art.py' and make sure to make ```artFile = art.py``` in config.py to use art.py
mainArt = \
'''
®❤ ★ ❤ ❤ ❤ ❤ *
® * ® ❤ ✺
④ _..._ ,s$$$s. ⑤ _..._ ,s$$$s.
④ .$$$$$$$s$$ss$$$$, ® ❤ ❤ ⑤ .$$$$$$$s$$ss$$$$,
④ $$$sss$$$$s$$$$$$$ ⑤ $$$sss$$$$s$$$$$$$
④ $$ss$$$$$$$$$$$$$$ ( ) ⑤ $$ss$$$$$$$$$$$$$$
® ❤ ④ '$$$s$$$$$$$$$$$$' ® ❣ ) (⑨*⑩) (⑨*⑩) ( ⑤ '$$$s$$$$$$$$$$$$'
④ '$$$$$$$$$$$$$$' (⑨*⑩) | | (⑨*⑩) ®❣ ⑤ '$$$$$$$$$$$$$$'
④ S$$$$$$$$$$$' | ⑤|~| ④|~| ②| ⑤ S$$$$$$$$$$$'
®❤ ④ '$$$$$$$$$' ③|~| ⑤| | ④| | ⑥|~| ⑤ '$$$$$$$$$' ® *
④ '$$$$$' ® ★ ✺ ③| | ⑤| | ④| | ⑥| | ®❤ ⑤ '$$$$$'
④ '$$$' ⑧,③| |⑧a@@@@⑤| |⑧@@@@@@@@@@@④| |⑧@@@@a⑥| |⑧. ⑤ '$$$'
④ ; ⑧.,a@@@③| |⑧@@@@@⑤| |⑧@@@@@@@@@@@④| |⑧@@@@@⑥| |⑧@@@@a,. ⑤ ;
®❤ ④ ; ⑧,a@@@@@@③| |⑧@@@@@@@@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,;;;;;;;;;;;;;;;'⑦%%%%%%%%%%%% ®★ ® ❤
⑦`%%%%%%%%%%%%%%%%%,,,,,,,%%%%%%%%%%%%%%%,,,,,,,%%%%%%%%%%%%%%%%%%%%'
⑦`%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
®★ ⑦`%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
®❤ ★ ⑦""""""""""""""`,,,,,,,,,'""""""""""""""""" ® ✺
②`%%%%%%%'
②`%%%%%' ® * ❤
®✺ ②%%%
® ❤ * ②%%%%% ® ★ ® ❤ *
②.,%%%%%%%,.
②,%%%%%%%%%%%%%%%%%%%, ® ❤
⑧ __ __ ____ ____ ____ __ __ ____ ____ ____ ______ __ __ ___ ____ __ __
⑧| | | / || \| \| | | | \ | || \| || | || \ / || | |
★ ⑧| | || o || o ) o ) | | | o ) | | | D ) || | || \ | o || | | ® ❤
⑧| _ || || _/| _/| ~ | | | | | | /|_| |_|| _ || D || || ~ |
⑧| | || _ || | | | |___, | | O | | | | \ | | | | || || _ ||___, |
⑧| | || | || | | | | | | | | | | . \ | | | | || || | || |
❣ ⑧|__|__||__|__||__| |__| |____/ |_____||____||__|\_| |__| |__|__||_____||__|__||____/ ® *
④ __,,,__ ⑧ ____ ____ ___ ___ ___ ④ __,,,__
✺ ④ ❤ ,-""-,-" "-,-""-, ⑧ | \ / || | | / _] ④ ,-""-,-" "-,-""-, ® ❤
★ ④ /,-' , .-'-.7.-'-. , '-,\ ⑧ | _ || o || _ _ | / [_ ④ /,-' , .-'-.7.-'-. , '-,\\
④ \( / _ _ \ )/ ⑧ | | || || \_/ || _] ④ \( / _ _ \ )/ ❤
④ '-, { (⑨0⑩) (⑨0⑩) } ,-'⑧ | | || _ || | || [_④ '-, { (⑨0⑩) (⑨0⑩) } ,-'
④ / > .---. < \ ⑧ | | || | || | || | ④ / > .---. < \\
④ ❤ |/ .-' \___/ '-. \| ⑧ |__|__||__|__||___|___||_____| ④ |/ .-' \___/ '-. \| ® ❤
❤ ④ {, / ,_ _, \ ,} ④ {, / ,_ _, \ ,}
④ \ {, \ / ,} / ④ \ {, \ / ,} / ® ❤
④ ',\. '---' ./,' ® * ② ④ ',\. '---' ./,'
② _.-""""""-._ _.-""""""-._ ② _.-""""""-._ _.-""""""-._
② .' `._.` '. ® ★ ② .' `._.` '.
®✺ ④ _②/④_ ② \ ④ _②/④_ ② \\ ® ★
④ .'` `\ ② \ ④ .'` `\ ② \\
④ / | ⑦ ymx ② ; ④ / | ⑦ gxy ② ;
④ | / ② | ④ | / ② |
④ \\ ;'---' ⑦ ymx ② ; ® ✺ ④ \\;'---' ⑦ gxy ② ; ® ❣
④ '. ; ④ _② ; ④ '. ; ④_② ;
® ★ ④ `-②\ ⑦ ymx ④ [].' `, ④ `-②\ ⑦ gxy ④[].' `,
② `\ ④ | \\ ② `\ ④| \\
② \ ④ \ | ❤ ② ❤ \ ④\ |
② `\ ④ /` _/ ® ★ ② `\ ④/` _/ ® ❤
④ ,-""-. .'②`\ /④`-,-'` .-""-, ④ ,-""-. .'②`\ /④`-,-'` .-""-,
④ / `\.' ② `\ /`④ './` \\ ④ / `\.' ② `\ /` ④'./` \\
④ ; .--. \ ② '\ /' ④ / .--. ; ④ ; .--. \ ② '\ /' ④/ .--. ;
④ ❤ | ( \ |, ② '\ /' ④ | / ) | ④ | ( \ |, ② '\ /' ④ | / ) |
④ \ ; } ;②\ /; ④ ` { ; / ®✺ ④ \ ; } ;②\ /; ④ ④` { ; /
④ `;\ \ _.-' ② \ / ④`-._ / /;` ④ `;\ \ _.-' ② \ / ④`-._ / /;`
®* ④ \ \__.' _.-' ② Y ④ `-._ '.__// ④ \ \__.' _.-' ② Y ④ `-._ '.__//
④ '.___,.-' `-.,___.' ④ '.___,.-' `-.,___.'
®★ ❤
❤ ⑦ : . ⑧ __________________ __________________ ⑦ : .
❤ ⑦ [""] ⑧ .-/| \ / |\-. ⑦ [""] ✺ ❣
⑦ | | ⑤ |⑧||| | |||⑤| ⑦ | |
★ ⑦ | | ⑤ |⑧||| | ~~*~~⑧ |||⑤| ⑦ | |
⑦ | | ⑤ |⑧||| ⑤--==*==--⑧ | |||⑤| ⑦ | | ® ❤
④ : ⑦ .'--`. ⑤ |⑧||| ⑤ 生日快乐 ⑧ | |||⑤| ⑦ .'--`. ④ :
❣ ④ : .: ⑦ /`.__.'\ ⑤ |⑧||| ⑤ 愿: ⑧ | |||⑤| ⑦ /`.__.'\ ④ : .: ® ✺
④ : . ⑦ / \ ⑤ |⑧||| ⑤每一岁都能奔走在 ⑧ | ⑤--==*==--⑧ |||⑤| ⑦ / \ ④ : .
③ ( ④ ,-'``'-.⑦ ; ; ⑤ |⑧||| ⑤ 自己的热爱里! ⑧ | ⑤- 生而自由 -⑧ |||⑤| ⑦ ; ; ④,-'``'-. ⑥ (
③ )\ ④ |`-..-'|⑦ | ,--. | ⑤ |⑧||| | ⑤- 爱而无畏 -⑧ |||⑤| ⑦ | ,--. | ④|`-..-'| ⑥ )\\
③ / ) ④| . :| ⑦|_.','`.`._| ⑤ |⑧||| | ⑤-让自己快乐快乐-⑧ |||⑤| ⑦ |_.','`.`._| ④| . :| ⑥ / )
③ ( ⑨*⑩ ③(④ | . : | ⑦|--' `--| ⑤ |⑧||| | ⑤---才是目的 ---⑧ |||⑤|⑦ |--' `--| ④| . : | ⑥( ⑨*⑩ (
③ \ #/ ④|`-..-'| ⑦|| | | | | ⑤ |⑧|||__________________ | _ ___|||⑤| ⑦|| | | | | ④|`-..-'| ⑥ \#/
③ .-"#'-. ④\::::::/ ⑦||)|/|)|)|\| ⑤ |⑧|/===================\|/===================\|⑤| ⑦||)|/|)|)|\| ④\::::::/⑥ .-"#'-.
★ ③ |"-.-"|⑤--④`::::'⑤--⑦|._ ~**~ _.|⑤------`--------------------~___~-------------------''------⑦|._ ~**~ _.|⑤--④`::::'⑤--⑥|"-.-"|
③ | | ④ )( ⑦ | `-..-' | ® ⑦ | `-..-' | ④)( ⑥| |
③ | | ④ )( ⑦ | | ® * ★ ⑦ | | ④)( ⑥| |
③ | |④ ,-')('-. ⑦| | ⑦ | | ④,-')('-. ⑥| | ® ❤
③ | |④( ' ` )⑦`-._ _.-' ® ★ ⑦ `-._ _.-'④( ' ` )⑥| |
③ '-._,-'④ `-....-' ⑦ ```` ® ❤ ❤ ⑦ ```` ④ `-....-' ⑥'-._,-'
®
® ✺ ❣ ✺ ❣ ★
'''
4.用python 运行PyBirthdayWish.py
PyBirthdayWish.py如下。
#!/usr/bin/python3
import os,random
from threading import Thread
from time import sleep
import vlc
from termcolor import colored
from config import *
# Importing module specified in the config file
art = __import__(f'arts.{artFile}', globals(), locals(), ['*'])
def replaceMultiple(mainString, toBeReplace, newString):
"""[Replace a set of multiple sub strings with a new string]
Args:
mainString ([string]): [String in which the replacement will be done]
toBeReplace ([list]): [A list which elements will be replaced by a newString]
newString ([string]): [A string which will be replaced in place of elements of toBeReplace]
Returns:
[string]: [Return the main string where the element of toBeReplace is replaced by newString]
"""
# Iterate over the list to be replaced
for elem in toBeReplace :
# Check if the element is in the main string
if elem in mainString :
# Replace the string
mainString = mainString.replace(elem, newString)
return mainString
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
def pprint(art,time):
color_used = [random.choice(color)]
colorAttribute = []
for i in range(len(art)):
if art[i] in colorCodes:
# Color attr set to blink if 9
if art[i] == '⑨':
colorAttribute = [colorCodes[art[i]]]
# color attr none if 10
elif art[i] == '⑩':
colorAttribute = []
# Random color if R
elif art[i] == '®':
color_used = color
else:
color_used = [colorCodes[art[i]]]
print(colored(replaceMultiple(art[i],colorCodes,''),random.choice(color_used),attrs=colorAttribute),sep='', end='',flush= True);sleep(time)
def pAudio():
if playAudio:
p = vlc.MediaPlayer(resource_path(audio))
p.play()
# Code reader
with open(resource_path(__file__)) as f_in:
code = f_in.read()
def pcode():
# Print the code before wishing
if codePrint:
for i in range(len(code)):
print(colored(code[i], codeColor),sep='', end='',flush= True);sleep(codingSpeed)
input('\n\n'+colored('python3','blue')+colored(' PyBirthdayWish.py','yellow'))
os.system('cls' if os.name == 'nt' else 'clear')
else:
input(colored('press F11 and hit {Enter}...','blue'))
os.system('cls' if os.name == 'nt' else 'clear')
# Clearing terminal
os.system('cls' if os.name == 'nt' else 'clear')
try:
pcode()
Thread(target = pAudio).start()
Thread(target = pprint, args=(art.mainArt,speed)).start()
input()
except KeyboardInterrupt:
print(colored('\n[-] Thanks!!','red'))
os._exit(0)
如果想要生成.exe文件发送的,参考下面的教程
文字内容可以编辑,可自行修改,动态的而且有音乐。
源码路径
hemantapkh/PyBirthdayWish: 🎈🎁 Wish your loved one a warm Happy Birthday in a pythonic way inside a terminal. (github.com)
作者:枫子有风