Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1a9f064

Browse files
Added Battery Notification Script
1 parent e41b2c3 commit 1a9f064

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import psutil
2+
from plyer import notification
3+
import time
4+
#From psutil we import sensors battery class which gives us battery percentage
5+
while(True):
6+
battery = psutil.sensors_battery()
7+
percent = battery.percent
8+
notification.notify(
9+
title = "Battery Percentage",
10+
message = str(percent) + "% Battery Remaining",
11+
timeout = 10
12+
)
13+
#After every 60 minutes it will show the battery percentage via a notification
14+
time.sleep(60*60)
15+
16+
17+
continue

‎Battery-Notification/README.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This is a Python Script which shows the battery percentage left
2+
3+
## Requirements
4+
5+
## For this script to run you need to have psutil and plyer packages installed
6+
7+
## Run the command in terminal to install package
8+
9+
```
10+
$ pip install psutil
11+
```
12+
```
13+
$ pip install plyer
14+
```
15+
## Run the program using command
16+
17+
```
18+
$ python battery_notification.py
19+
```

‎SCRIPTS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,4 @@
9393
| 89\. | Voice-Assistant | Voice-Assistant Bot | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/Voice-Assistant) | [Avinash .K. Rajan](https://github.com/avinashkranjan) |
9494
| 90\. | Website-Status-Checker | This script will check the status of the web address which you will input | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/Website-Status-Checker) | [Avinash .K. Rajan](https://github.com/avinashkranjan) |
9595
| 91\. | Movie-Genre-Prediction-Chatbot | An chatbot will predict the genre of the movie based on the input text. | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/Movie-Genre-Prediction-Chatbot) | [Hritik Jaiswal](https://github.com/hritik5102) |
96+
| 92\. |Battery-Notification |A Script that notifies about the current battery left. | [Take Me] (https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/Battery-Notification) | [Pankaj Biradar](https://github.com/pankaj892) |

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /