battery notification added

This commit is contained in:
Dauragtiwari 2022-10-09 20:20:28 +05:30
parent 6a96ef559f
commit e2ea5a726c
3 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,13 @@
This python File used to give notification about your battery percentage of the device.
Pre-requisites:-you need to install python on your desktop along with some awesome packages as follows:-
1.)psutil :-pip install psutil
2.)pynotifier :- pip install py-notifier
3.)win10toast :- pip install win10toast
thanks for reading!!

View File

@ -0,0 +1,19 @@
# pip install psutil
import psutil
battery = psutil.sensors_battery()
plugged = battery.power_plugged
percent = battery.percent
if percent <= 30 and plugged!=True:
# pip install py-notifier
# pip install win10toast
from pynotifier import Notification
Notification(
title="Battery Low",
description=str(percent) + "% Battery remain!!",
duration=5, # Duration in seconds
).send()

View File

@ -0,0 +1,3 @@
psutil==5.7.2
py-notifier==0.1
win10toast==0.9