5 Python Projects That Can Be Built Under 5 Minutes

5 Python Projects That Can Be Built Under 5 Minutes
Sai Ashish Konchada

Published on Mar 9, 2021

11 min read

Subscribe to my newsletter and never miss my upcoming articles

Listen to this article

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?

1. Notification Generator 🔢 
2. Check Your Battery Percentage 🔋
3. Take a Screenshot 🖼
4. Figlet Generator 🔠
5. ConvertText to Speech 🗣

What Are We Going to Learn Today?

1. How to effectively use modules in our python programs
2. Basics of Python: Functions

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:

Notification Generator Using Python

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,

pip install win10toast

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,

from win10toast import ToastNotifier

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

def windows_popup(title,content,duration=10):

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,

toast=ToastNotifier()
toast.show_toast(title,content,duration=duration)

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:

windows_popup("Reminder", "Go and get a life!")

Final Source Code for Notification Generator is seen below:

Final Source Code for Notification Generator Using Python

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:

pip install psutil

Time to Code!

As always, import the psutil module into our environment.

import psutil

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

battery = psutil.sensors_battery()

Gain the battery percentage information into variable percent as follows:

percent = str(battery.percent)

To display the battery percent on the screen, type:

print("Battery Percent= " + percent + "%")

Final Source Code for Battery Percentage Checker:

Final Source Code for Battery Percentage Checker Using Python

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:

pip install pyautogui

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:

import pyautogui
import time

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

time.sleep(3)

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

img = pyautogui.screenshot()

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

img.save(r"image.png")

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:

Screenshot Taker Using Python

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:

Figlet output image

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:

pip install pyfiglet

Time to Code!

The first step is to import the Pyfiglet module

import pyfiglet

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 a normal block, just omit that parameter and enter only the text in double-quotes.

result = pyfiglet.figlet_format("Sai Ashish", font = "slant")

Display your creativity using the print statement:

print(result)

Final Source Code for Figlet Generator:

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 favourite 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:

pip install pyttsx3

Time to Code!

We import the pyttsx3 module into our environment using:

import pyttsx3

To get the remote control, we initialise pyttsx3 as:

engine = pyttsx3.init()

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

engine.say("Hello Everyone")

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

engine.runAndWait()

Final Source Code for Converting Text to Speech:

 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 💯

Bonus Insights by The Insightful Coder :

  • 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 🎁

 
Share this
Proudly part of