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.
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.
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
First, install pip in Ubuntu, 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.
.requirements.txt
After the installation is complete, inside the PyBirthdayWish directory, that you have cloned, run the command below:
PyBirthdayWish
python3 PyBirthdayWish.py
This will ask you to press F11 and then enter to go full screen mode and then play the animation.
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.
Subscribe
Email sent! Check your inbox to complete your signup.
Followed by more than 20,000 Linux users worldwide
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.
example
art
artwithstars
Now, if you want to use the artwithstars file instead of the default example, open the config.py in any available text editor, replace the arts entry with the required name and save it, as shown in the screenshot below:
config.py
arts
After that, in the PyBirthdayWish directory, run:
And you will get the new animation.
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.
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.
| _ \ /
💡 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.
You can now run to get your required text inside the animation:
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.
Edit the config.py file to add the new music, as shown in the screenshot below:
Done! Now, if you execute the run command, python3 PyBirthdayWish.py, the custom music will be played along with the animation.
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
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.
.local/bin
So add that directory to your path using:
export PATH=$PATH:/home/team/.local/bin
To make it permanent, add it to your ~/.bashrc file.
~/.bashrc
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.
PyBirthdayWish/dist
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.
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 选题:lkxed 译者:译者ID 校对:校对者ID
本文由 LCTT 原创编译,Linux中国 荣誉推出