In this tutorial we will learn how can we check battery percentage using python and how can we send the battery percentage notification to desktop.

We need to external modules one is psutil and the other one is pynotifier

to install psutil type “pip install psutil” in your terminal
to install pynotifier, type “pip install py-notifier” in your terminal

Code==
from pynotifier import Notification
import psutil
battery = psutil.sensors_battery()
percent = battery.percent
Notification(“Battery Percentage”, str(percent)+ “%Percent Remaining”, duration=10).send()

Also, you should visit our website for small to large python projects
website== copyassignment.com

Subscribe : https://www.youtube.com/channel/UCDiuekGKuQWYrs_5yMczLWQ

#python

Check Battery Percentage Using Python and Send Notification to Desktop
48.75 GEEK