Selasa, 04 Juli 2023

Display Animated ASCII Birthday Wish in Linux Terminal

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.

0:00
/0:15

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.

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.

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.

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.

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.

Display Animated ASCII Birthday Wish in Linux Terminal πŸŽ‚
Default art files

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:

Display Animated ASCII Birthday Wish in Linux Terminal πŸŽ‚
Change the design file

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.

Display Animated ASCII Birthday Wish in Linux Terminal πŸŽ‚
New text "Friend" added as a new file
πŸ’‘

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.

Display Animated ASCII Birthday Wish in Linux Terminal πŸŽ‚
Change the config file to highlight the new file

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.

Display Animated ASCII Birthday Wish in Linux Terminal πŸŽ‚
Custom music file is copied inside the directory

Edit the config.py file to add the new music, as shown in the screenshot below:

Display Animated ASCII Birthday Wish in Linux Terminal πŸŽ‚
Custom music file added to config file

Done! Now, if you execute the run command, python3 PyBirthdayWish.py, the custom music will be played along with the animation.

Display Animated ASCII Birthday Wish in Linux Terminal πŸŽ‚

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

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 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.

Display Animated ASCII Birthday Wish in Linux Terminal πŸŽ‚
Executable file location

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.

Celebrate Christmas in Linux Way: Give Your Linux System a Christmas Touch
It’s the holiday season and many of you might be celebrating Christmas already. From the team of It’s FOSS, I would like to wish you a Merry Christmas and a happy new year. To continue the festive mood, I’ll show you some really awesome Linux wallpapers on
Display Animated ASCII Birthday Wish in Linux Terminal πŸŽ‚

If you liked ASCII animation, you may like ASCII art, too.

Convert Images to ASCII Art in Linux Terminal
Want some fun in the Linux terminal? How about converting a regular image into ASCII art? This tool lets you convert any image into ASCII art.
Display Animated ASCII Birthday Wish in Linux Terminal πŸŽ‚

And why just stop here? Explore more ASCII tools.

10 Tools to Generate and Have Fun With ASCII Art in Linux Terminal
Linux terminal is not as scary as you think. Of course, it could be intimidating in the beginning but once you know the terminal better, you start loving it. You are likely to use the terminal for serious work. But there are many fun stuff you can do in the
Display Animated ASCII Birthday Wish in Linux Terminal πŸŽ‚

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.



from It's FOSS https://ift.tt/XHtLaiG
via IFTTT

Tidak ada komentar:

Posting Komentar