Python to Battery Notificator with Full Source Code

This python script Battery Notificator gives you a notification about the battery percentage of the device.


  • You will need to install python on your machine.
  • You can download python from and install it.
  • And a few other python packages that you need to install are as:
1. psutil
    > pip install psutil

2. pynotifier
    > pip install py-notifier

3. win10toast
    > pip install win10toast

How to run the Script:

Code language: CSS (css)


  • psutil==5.7.2
  • py-notifier==0.1
  • win10toast==0.9

Souce Code:

# pip install psutil
import psutil

battery = psutil.sensors_battery()
plugged = battery.power_plugged
percent = battery.percent

if percent >= 30:
    # pip install py-notifier
    # pip install win10toast
    from pynotifier import Notification

        title="Battery Low",
        description=str(percent) + "% Battery remain!!",
        duration=5,  # Duration in seconds

Leave a Comment