5 Python Projects That Can Be Built Under 5 Minutes

Welcome to the Python Projects for Beginners Series 🙋🏻‍♂️

I’m Sai Ashish and today, we are going to code 5 Python Projects that can be built in under 5 minutes 🤯

I hope you’re psyched because this is going to be amazing 💯

What Are We Going to Build?

What Are We Going to Learn Today?

Project 1: Notification Generator 🔢

As the name suggests, a notification generator generates a notification(a message) about a particular task, reminder or anything you require. In today’s build, we would be generating a pop-up notification on a Windows device.

Apart from the obvious, you can integrate this snippet of code into any of your applications. For example, in How to Build an Alarm Clock using Python, you can also generate a notification along with your favourite song. Or suppose you wanted to get an alert whenever your battery percentage is below 35 or get reminders, this is the tool for you.

Let’s Have a Look at Our Build:

Module Used:

For this build, we require the win10toast module. win10toast is an easy-to-use Python library for displaying Windows 10 Toast(Pop-up) Notifications. The official document of the module can be accessed from here.

To install the win10toast module, go to the terminal and run,

That’s it. You’re all ready for the build now.

Time to Code!

The first step is to import the win10toast module into our programming environment. For this, we use the import statement as,

Next, we define a function named windows_popup that takes three parameters as input — title, content and duration.

Functions help break our program into smaller and modular chunks. Moreover, it avoids repetition and makes the code reusable.

In our function, we code two statements,

We create an instance of the ToastNotifier class and store it inside toast variable. Imagine the instance as a remote control to your program. You can now use any buttons on the remote control to perform the task needed.

We call the show_toast function and pass the input parameters as seen.

Parameters:

title: the title of the notification. it appears in bold. Example: Reminder
content: the content of the notification. Example: Close down your desktop and go for a walk!
duration: the duration in seconds you want the notification to be shown on the screen

Finally, we call the function as:

Final Source Code for Notification Generator is seen below:

You can directly download the source code for Notification Generator from my Github Respository.

Project 2: Check Your Battery Percentage 🔋

In this build, we generate the battery percentage of our device.

Module Used:

For this build, we use the psutil module. psutil is a cross-platform library for process and system monitoring in Python. The official documentation of the psutil module can be found here.

To install psutil into our system, type in the terminal the following:

Time to Code!

As always, import the psutil module into our environment.

Gain the remote control by creating an instance of the sensors_battery() class in the psutil module.

Gain the battery percentage information into variable percent as follows:

To display the battery percent on the screen, type:

Final Source Code for Battery Percentage Checker:

You can directly download the Battery Percentage Checker code from my Github Repository too.

To test your coding skills, try generating a notification when the battery percentage falls below 35%. Comment your code in the comment box below!

Project 3: Take a Screenshot 🖼

Modules Required:

For this build we require the Pyautogui and the time module.

PyAutoGUI is a python module that lets you control your mouse and keyboard using a program. PyAutoGUI also lets you automate your everyday tasks and can play games, login into emails, and more. You can access the official documentation of Pyautogui module from here.

To install PyAutoGUI in your system, open your terminal and run:

The time module provides various time-related functions. We use it to retrieve the system time and display it on the screen. You can access the official documentation from here

Time to Code!

Importing the required modules into our python environment:

We use the time.sleep method to switch the application from our python environment to the screen we want to take a screenshot from.

To take the screenshot, we use pyautogui’s screenshot method and store it inside the img variable.

To save the image, we use the save method as:

Note: This command will save the image into the same directory as the location of the python file you’re running from.

Final Source Code for Screenshot Taker is as follows:

You can directly download the source code of the Screenshot Taker build from here.

Project 4: Figlet Generator 🔠

The Figlet Generator Converts ordinary text into a creative figure letter design(ASCII Art Font) as shown below:

Modules Required:

For this build, we require the PyFiglet module. You can access the official documentation of Pyfiglet module from here. The PyFiglet module can be installed by using:

Time to Code!

The first step, is to import the Pyfiglet module

To convert your word into ASCII Block Art format we use the figlet_format function. We store the result into a variable called result. For slant font, we set the font to slant. For normal block, just omit that parameter and enter only the text in double quotes.

Display your creativity using the print statement:

Final Source Code for Figlet Generator:

You can directly download the source code from my Github Repository.

Project 5: Convert Text to Speech 🗣

Last but not the last and my most favorite build among all, the Text to Speech Generator.

Module Required:

For this amazing build, we require the pyttsx3 module. pyttsx3 is a text-to-speech conversion library in Python. Unlike alternative libraries, it works offline, and is compatible with both Python 2 and 3.You can check the official documentation from here

To install pyttsx3 into our system, go to the terminal and type:

Time to Code!

We import the pyttsx3 module into our environment using:

To get the remote control, we initialise pyttsx3 as:

After gaining the instance, we use the say method to tell the engine to speak the sentence provided to it.

Finally, we use the runAndWait command to run the command.

Final Source Code for Converting Text to Speech:

You can directly download the Text to Speech Build from my Github Repository.

That’s it, folks! We have successfully learnt 5 short yet interesting builds that can be implemented in under 5 minutes. These builds are a very good stepping step for any beginner in Python. If this blog provided value to you smash the like button and subscribe to the newsletter to never miss another blog update 💯

  • Interested in Building Your Own Artificial Intelligence Projects using Python?: Check out the Python AI Series 🧠
  • Wanna Discover Some Valuable Tech-Hacks 🛠?: Check out the Tech-Hacks for Everybody Series 😎
  • I’m also dropping daily value bombs and development insights on my Instagram Page. Make sure to follow me up 💯
  • Find and Download All My Project Source Codes at My Github Repository 🎁

Originally published at https://theinsightfulcoder.com.

👨🏻‍🎓Technical Head at SLRTCE 🚀 Fluent with C, C++, Java, Python ✍🏻Technical Blogger 💪🏻Personal Development Blogger 💻IoT and AI Enthusiast