Coders Packet

Battery Reminder for Laptop in Python

By Vaibhav sharma

It's a Python script which reminds me with the current state of my Laptop Battery Percentage.

Installing Important Modules

pip install psutil

pip install plyer

Importing Modules

import psutil

from plyer import notification 

After importing modules we need to specify the Parameters 

  • If plugged in:
    • If battery <= 80%, advise charging to 80%.
    • If battery is 100%, advise unplugging.
    • For 80%-100%, advise unplugging for better battery life.
  • If not plugged in:
    • If battery <= 20%, advise plugging in.
    • If battery <= 50%, display the percentage.
    • If battery is 100%, notify it's fully charged.
    • For other percentages, show the current battery percentage.

Run script

Download Complete Code

Comments

No comments yet

Download Packet

Reviews Report

Submitted by Vaibhav sharma (Vaibhav2004)

Download packets of source code on Coders Packet