mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
[手动选题][tech]: 20230705.0 ⭐️⭐️ Display Animated ASCII Birthday Wish in Linux Terminal 🎂.md
This commit is contained in:
parent
4c8882394e
commit
575ed5e506
@ -0,0 +1,211 @@
|
||||
[#]: subject: "Display Animated ASCII Birthday Wish in Linux Terminal 🎂"
|
||||
[#]: via: "https://itsfoss.com/birthday-wish-linux-terminal/"
|
||||
[#]: author: "Sreenath https://itsfoss.com/author/sreenath/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Display Animated ASCII Birthday Wish in Linux Terminal 🎂
|
||||
======
|
||||
|
||||
Birthdays are special occasions, and it’s very satisfying and a pleasure to get birthday wishes from loved ones.
|
||||
|
||||
As a Linux user, you can surprise our friends and family with some cool birthday wishes from the terminal.
|
||||
|
||||
Here's a birthday card (or should I say animation) I created for the birthday of Abhishek Sir.
|
||||
|
||||
<video src="https://itsfoss.com/content/media/2023/07/birthday-wish-linux-terminal.webm" autoplay>
|
||||
|
||||
Everyone in the team liked it so much that I was requested to do a tutorial on it. I am only glad to comply as it may help our readers :)
|
||||
|
||||
> ✋ This tutorial requires editing config files in the terminal. Proficiency with Linux terminals and commands make it easier to follow this tutorial.
|
||||
|
||||
### Install PyBirthdayWish
|
||||
|
||||
PyBirthdayWish is a small Python program through which you can create beautiful terminal birthday wishes. With music too!
|
||||
|
||||
The program itself is not available in the default repositories of Ubuntu. You need to install it using Pip.
|
||||
|
||||
[PyBirthdayWish GitHub][1]
|
||||
|
||||
First, [install pip in Ubuntu][2], using the command below:
|
||||
|
||||
```
|
||||
sudo apt install python3-pip
|
||||
```
|
||||
|
||||
Once Pip is installed, you can clone the repo and install the program:
|
||||
|
||||
```
|
||||
git clone https://github.com/hemantapkh/PyBirthdayWish.git && cd PyBirthdayWish && pip install -r requirements.txt
|
||||
```
|
||||
|
||||
On their repo, you can check the `.requirements.txt` file to know what are the requirements as mentioned in the above command.
|
||||
|
||||
After the installation is complete, inside the `PyBirthdayWish` directory, that you have cloned, run the command below:
|
||||
|
||||
```
|
||||
python3 PyBirthdayWish.py
|
||||
```
|
||||
|
||||
This will ask you to press F11 and then enter to go full screen mode and then play the animation.
|
||||
|
||||
![][3]
|
||||
|
||||
![][4]
|
||||
|
||||
There is music too, but not shown here.
|
||||
|
||||
It's highly customizable. **Let me show various levels of optional customization you can do with this tool.**
|
||||
|
||||
### Sign up for FOSS Weekly
|
||||
|
||||
#### Become better at using Linux desktop every week
|
||||
|
||||
Subscribe
|
||||
|
||||
|
||||
Email sent! Check your inbox to complete your signup.
|
||||
|
||||
|
||||
Followed by more than 20,000 Linux users worldwide
|
||||
|
||||
### Create the default birthday wish
|
||||
|
||||
In the above program, there are three wish Python files that can be used for the animation. They are, _`example`_(default), _`art`_ and _`artwithstars`_. You can open these three files in text editor to get an overview.
|
||||
|
||||
![Contents of the arts directory, which has the default and user created art files][5]
|
||||
|
||||
Now, if you want to use the _`artwithstars`_ file instead of the default example, open the _`config.py`_ in [any available text editor][6], replace the _`arts`_ entry with the required name and save it, as shown in the screenshot below:
|
||||
|
||||
![Change the animation design file to "art with stars" on the config file][7]
|
||||
|
||||
After that, in the `PyBirthdayWish` directory, run:
|
||||
|
||||
```
|
||||
python3 PyBirthdayWish.py
|
||||
```
|
||||
|
||||
And you will get the new animation.
|
||||
|
||||
### Create a custom birthday wish
|
||||
|
||||
What if you want to print the name of your loved one, instead of the default text? This needs a little bit of patience because you need to edit the art file without destroying it.
|
||||
|
||||
First, make a backup copy of the design art files you want. Which is basically copying the file in the same `arts` directory but with a different name; say `friend.py`.
|
||||
|
||||
Now, open the design art file with the text editor of your choice. Replace the text in the art file with the one you need. It will be wise to use the symbols `| _ \ /` for creating the text, design etc. You can use an [online tool to convert text to ASCII][8].
|
||||
|
||||
![Copied one of the existing design files and added a new text "Friend"][9]
|
||||
|
||||
> 💡 Typing one character moves the rest of the animation one character forward. Similarly, removing a character moves the rest of the design, one character backward. So, you should add a space if you remove a character. Similarly, remove one space if you added a new character on a particular line. This should be done in real-time so that you can view the changes. This way, you can match the rest of the design and not destroy the looks, when completed.
|
||||
|
||||
After completing the edit, save it. Now, open _config.py_ and change the art file to show your file.
|
||||
|
||||
![Change the design file in the config to reflext the changes we have done][10]
|
||||
|
||||
You can now run to get your required text inside the animation:
|
||||
|
||||
```
|
||||
python3 PyBirthdayWish.py
|
||||
```
|
||||
|
||||
### Use your own music file
|
||||
|
||||
You can use your own music file as part of this animation.
|
||||
|
||||
> 🚧 If you are planning to upload the video on YouTube of other such sites, please use copyright-free music to avoid issues.
|
||||
|
||||
Copy your music file inside the cloned directory.
|
||||
|
||||
![Custome music file is copied inside the cloned directory][11]
|
||||
|
||||
Edit the _config.py_ file to add the new music, as shown in the screenshot below:
|
||||
|
||||
![Adding the custom music file to the config file to play it during animation][12]
|
||||
|
||||
Done! Now, if you execute the run command, `python3 PyBirthdayWish.py`, the custom music will be played along with the animation.
|
||||
|
||||
![][13]
|
||||
|
||||
##### New Book: Efficient Linux at the Command Line
|
||||
|
||||
Pretty amazing Linux book with lots of practical tips. It fills in the gap, even for experienced Linux users. Must have in your collection.
|
||||
|
||||
[Get it from Amazon][14]
|
||||
|
||||
### Create an executable
|
||||
|
||||
**If you want to send the above wish message as an executable to a friend, there is a way for this too.**
|
||||
|
||||
An associated pyinstaller will be installed to the `.local/bin` directory, which will not be on your path.
|
||||
|
||||
So [add that directory to your path][15] using:
|
||||
|
||||
```
|
||||
export PATH=$PATH:/home/team/.local/bin
|
||||
```
|
||||
|
||||
To make it permanent, add it to your `~/.bashrc` file.
|
||||
|
||||
After you are done with the art file editing and changing the config file to reflect the change, use the command below to create an executable:
|
||||
|
||||
```
|
||||
pyinstaller --noconfirm --onefile --console --icon "icon.ico" --no-embed-manifest --add-data "arts:arts/" --add-data "config.py:." --add-data "HappyBirthday.mp3:." --add-data "PyBirthdayWish.py:." "PyBirthdayWish.py"
|
||||
```
|
||||
|
||||
It will create an executable file named “PyBirthdayWish” to the `PyBirthdayWish/dist` directory.
|
||||
|
||||
![The custome executable file created by the program, showed in file manager][16]
|
||||
|
||||
Copy this executable and send to anybody who want to view this. They can execute it with:
|
||||
|
||||
```
|
||||
./PyBirthdayWish
|
||||
```
|
||||
|
||||
> 🚧 Always be cautious while running executables from unknown external sources.
|
||||
|
||||
### More terminal fun
|
||||
|
||||
Like Birthdays, Christmas too is a special occasion. You can give some festive touch to your Linux desktop if you want.
|
||||
|
||||
If you liked ASCII animation, you may like ASCII art, too.
|
||||
|
||||
And why just stop here? Explore more ASCII tools.
|
||||
|
||||
Enjoy using Linux in this fun way :)
|
||||
|
||||
_🗨 Let me know if you face any issues with this tool and I'll try to help in my capacity._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/birthday-wish-linux-terminal/
|
||||
|
||||
作者:[Sreenath][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/sreenath/
|
||||
[b]: https://github.com/lkxed/
|
||||
[1]: https://github.com:443/hemantapkh/PyBirthdayWish
|
||||
[2]: https://itsfoss.com/install-pip-ubuntu/
|
||||
[3]: https://itsfoss.com/content/images/2023/07/animation-page-1.png
|
||||
[4]: https://itsfoss.com/content/images/2023/07/animation-page-2.png
|
||||
[5]: https://itsfoss.com/content/images/2023/07/arts-directory-contents.png
|
||||
[6]: https://itsfoss.com/command-line-text-editors-linux/
|
||||
[7]: https://itsfoss.com/content/images/2023/07/add-art-with-stars.png
|
||||
[8]: https://patorjk.com:443/software/taag/#p=display&f=Big&t=Friend
|
||||
[9]: https://itsfoss.com/content/images/2023/07/new-text-added-to-art-file-friend.png
|
||||
[10]: https://itsfoss.com/content/images/2023/07/edit-config-file-to-add-custom-py-file.png
|
||||
[11]: https://itsfoss.com/content/images/2023/07/showing-mymusic-file-in-directory.png
|
||||
[12]: https://itsfoss.com/content/images/2023/07/custom-music-file.png
|
||||
[13]: https://itsfoss.com/content/images/2023/04/efficient-at-linux-command-line-horizontal.png
|
||||
[14]: https://amzn.to:443/3MPjiHw
|
||||
[15]: https://itsfoss.com/add-directory-to-path-linux/
|
||||
[16]: https://itsfoss.com/content/images/2023/07/PyBirthdayWish-executable-location.png
|
Loading…
Reference in New Issue
Block a user