From 1a9f0644133633e0b1bdb8e94a0662ccd5ae55e4 Mon Sep 17 00:00:00 2001 From: Pankaj Biradar Date: 2021年3月26日 17:16:50 +0530 Subject: [PATCH 01/16] Added Battery Notification Script --- Battery-Notification/Battery-Notification.py | 17 +++++++++++++++++ Battery-Notification/README.md | 19 +++++++++++++++++++ SCRIPTS.md | 1 + 3 files changed, 37 insertions(+) create mode 100644 Battery-Notification/Battery-Notification.py create mode 100644 Battery-Notification/README.md diff --git a/Battery-Notification/Battery-Notification.py b/Battery-Notification/Battery-Notification.py new file mode 100644 index 0000000000..d75529cb53 --- /dev/null +++ b/Battery-Notification/Battery-Notification.py @@ -0,0 +1,17 @@ +import psutil +from plyer import notification +import time +#From psutil we import sensors battery class which gives us battery percentage +while(True): + battery = psutil.sensors_battery() + percent = battery.percent + notification.notify( + title = "Battery Percentage", + message = str(percent) + "% Battery Remaining", + timeout = 10 + ) + #After every 60 minutes it will show the battery percentage via a notification + time.sleep(60*60) + + + continue \ No newline at end of file diff --git a/Battery-Notification/README.md b/Battery-Notification/README.md new file mode 100644 index 0000000000..d92ad4bf8b --- /dev/null +++ b/Battery-Notification/README.md @@ -0,0 +1,19 @@ +# This is a Python Script which shows the battery percentage left + +## Requirements + +## For this script to run you need to have psutil and plyer packages installed + +## Run the command in terminal to install package + +``` +$ pip install psutil +``` +``` +$ pip install plyer +``` +## Run the program using command + +``` +$ python battery_notification.py +``` \ No newline at end of file diff --git a/SCRIPTS.md b/SCRIPTS.md index ba1255ea5d..cbb26532a8 100644 --- a/SCRIPTS.md +++ b/SCRIPTS.md @@ -93,3 +93,4 @@ | 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) | | 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) | | 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) | +| 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) | \ No newline at end of file From 661616ecf55048303a2a332602dc25c048f5d5a9 Mon Sep 17 00:00:00 2001 From: pankaj892 <31444506+pankaj892@users.noreply.github.com> Date: 2021年3月26日 21:31:37 +0530 Subject: [PATCH 02/16] Update Battery-Notification/README.md Co-authored-by: Santushti Sharma <60578091+santushtisharma10@users.noreply.github.com> --- Battery-Notification/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Battery-Notification/README.md b/Battery-Notification/README.md index d92ad4bf8b..8721070521 100644 --- a/Battery-Notification/README.md +++ b/Battery-Notification/README.md @@ -2,9 +2,9 @@ ## Requirements -## For this script to run you need to have psutil and plyer packages installed +For this script to run you need to have psutil and plyer packages installed -## Run the command in terminal to install package +Run the command in terminal to install package ``` $ pip install psutil @@ -16,4 +16,4 @@ $ pip install plyer ``` $ python battery_notification.py -``` \ No newline at end of file +``` From f84f18b7f871bb5e78663a13437fcfdb46b156e1 Mon Sep 17 00:00:00 2001 From: pankaj892 <31444506+pankaj892@users.noreply.github.com> Date: 2021年3月26日 21:33:10 +0530 Subject: [PATCH 03/16] Update README.md --- Battery-Notification/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Battery-Notification/README.md b/Battery-Notification/README.md index 8721070521..887a2663ac 100644 --- a/Battery-Notification/README.md +++ b/Battery-Notification/README.md @@ -12,8 +12,8 @@ $ pip install psutil ``` $ pip install plyer ``` -## Run the program using command +Run the program using command ``` -$ python battery_notification.py +$ python Battery-Notification.py ``` From 9ebc91b240400562a4142f30aaa627e16639d5e7 Mon Sep 17 00:00:00 2001 From: pankaj892 <31444506+pankaj892@users.noreply.github.com> Date: 2021年3月27日 22:23:30 +0530 Subject: [PATCH 04/16] Update SCRIPTS.md --- SCRIPTS.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SCRIPTS.md b/SCRIPTS.md index cbb26532a8..60703c668d 100644 --- a/SCRIPTS.md +++ b/SCRIPTS.md @@ -92,5 +92,4 @@ | 88\. | Traffic-Sign-Detection | Using German Traffic Sign Recognition Benchmark, in this script I have used Data Augmentation and then passed the images to miniVGGNet (VGG 7) a famous architecture of Convolutional Neural Network (CNN). | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/Traffic-Sign-Detection) | [Vybhav Chaturvedi](https://github.com/vybhav72954) | | 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) | | 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) | -| 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) | -| 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) | \ No newline at end of file +| 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 Jais From e8a3559c62459d4090eefab75615508a03288cc0 Mon Sep 17 00:00:00 2001 From: pankaj892 <31444506+pankaj892@users.noreply.github.com> Date: 2021年3月28日 10:42:28 +0530 Subject: [PATCH 05/16] Update SCRIPTS.md --- SCRIPTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SCRIPTS.md b/SCRIPTS.md index 60703c668d..ba1255ea5d 100644 --- a/SCRIPTS.md +++ b/SCRIPTS.md @@ -92,4 +92,4 @@ | 88\. | Traffic-Sign-Detection | Using German Traffic Sign Recognition Benchmark, in this script I have used Data Augmentation and then passed the images to miniVGGNet (VGG 7) a famous architecture of Convolutional Neural Network (CNN). | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/Traffic-Sign-Detection) | [Vybhav Chaturvedi](https://github.com/vybhav72954) | | 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) | | 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) | -| 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 Jais +| 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) | From 54daeb978341c36e8fd85f44162a8fbfc8f56618 Mon Sep 17 00:00:00 2001 From: pankaj892 <31444506+pankaj892@users.noreply.github.com> Date: Tue, 6 Apr 2021 20:14:37 +0530 Subject: [PATCH 06/16] Update Battery-Notification.py --- Battery-Notification/Battery-Notification.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Battery-Notification/Battery-Notification.py b/Battery-Notification/Battery-Notification.py index d75529cb53..c794872916 100644 --- a/Battery-Notification/Battery-Notification.py +++ b/Battery-Notification/Battery-Notification.py @@ -8,10 +8,8 @@ notification.notify( title = "Battery Percentage", message = str(percent) + "% Battery Remaining", - timeout = 10 + timeout = 5 ) #After every 60 minutes it will show the battery percentage via a notification - time.sleep(60*60) - - - continue \ No newline at end of file + time.sleep(60) + continue From e7367b1dd31f5c2a89f1f13eec3f1c6df1e9b8f2 Mon Sep 17 00:00:00 2001 From: "LAPTOP-SNSEHSAR\\ayush" Date: Fri, 9 Apr 2021 10:12:20 +0530 Subject: [PATCH 07/16] GUI Implementation done --- IPL Statistics GUI/ipl.py | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 IPL Statistics GUI/ipl.py diff --git a/IPL Statistics GUI/ipl.py b/IPL Statistics GUI/ipl.py new file mode 100644 index 0000000000..beb5d742ce --- /dev/null +++ b/IPL Statistics GUI/ipl.py @@ -0,0 +1,59 @@ +# python program demonstrating +# Combobox widget using tkinter +import tkinter as tk +from tkinter import ttk + +# Creating tkinter window +window = tk.Tk() +window.title('Combobox') +window.geometry('800x850') + +# label text for title +ttk.Label(window, text="IPL Statistics", + background='blue', foreground="white", + font=("Helvetica", 20)).grid(row=0, column=1) + +# label +ttk.Label(window, text="Select category and year :", + font=("Helvetica", 15)).grid(column=0, + row=5, padx=10, pady=25) + + +def getSearchvals(): + print(category.get(), year.get()) + + +# Combobox creation +category = ttk.Combobox( + window, width=27, state='readonly') +year = ttk.Combobox( + window, width=27, state='readonly') + +submit_btn = ttk.Button(window, text="Search", command=getSearchvals) + +# Adding combobox drop down list +category['values'] = ('Most Runs', 'Most Fours', + 'Most Sixes', 'Most Fifties', 'Most Centuries', 'Highest Scores', 'Most Wickets', 'Most Maidens', 'Most Dot Balls', 'Best Bowling Average', 'Best Bowling Economy', 'Best Bowling Strike Rate') + +year['values'] = ('2020', '2019', '2018', '2017', '2016', + '2015', '2014', '2013', '2012', '2011', '2010', '2009', '2008') + +category.grid(column=1, row=5, padx=10) +category.current(0) + +year.grid(column=2, row=5, padx=10) +year.current(0) + +submit_btn.grid(row=5, column=3, pady=5, padx=15, ipadx=5) + +frame = ttk.Frame(window) +frame.place(relx=0.50, rely=0.12, relwidth=0.98, relheight=0.90, anchor="n") + +# global query_label +query_label = ttk.Label( + frame, anchor="nw", justify="left", text=("The workspace above has a list of tasks/ideas that could serve as utilities for managing OpenAPI specifications eg. cleanup tasks, adding default responses.\n")*50) +query_label.grid(row=7, columnspan=2) + +# query_label['text'] = "The workspace above has a list of tasks/ideas that could serve as utilities for managing OpenAPI specifications eg. cleanup tasks, adding default responses." + +window.mainloop() From c4bc0dd1c39d083dc966f746eb3ac863feff495f Mon Sep 17 00:00:00 2001 From: "LAPTOP-SNSEHSAR\\ayush" Date: Fri, 9 Apr 2021 11:48:43 +0530 Subject: [PATCH 08/16] web scraping and showing result in GUI complete --- IPL Statistics GUI/ipl.py | 75 +++++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 14 deletions(-) diff --git a/IPL Statistics GUI/ipl.py b/IPL Statistics GUI/ipl.py index beb5d742ce..aa3764a20b 100644 --- a/IPL Statistics GUI/ipl.py +++ b/IPL Statistics GUI/ipl.py @@ -1,11 +1,66 @@ -# python program demonstrating -# Combobox widget using tkinter +import requests +from bs4 import BeautifulSoup import tkinter as tk from tkinter import ttk +# Dictionary containing category and corresponding slug value +categories = {'Most Runs': 'most-runs', + 'Most Fours': 'most-fours', 'Most Sixes': 'most-sixes', 'Most Fifties': 'most-fifties', + 'Most Centuries': 'most-centuries', 'Highest Scores': 'highest-scores', 'Most Wickets': 'most-wickets', + 'Most Maidens': 'most-maidens', 'Most Dot Balls': 'most-dot-balls', 'Best Bowling Average': 'best-bowling-average', + 'Best Bowling Economy': 'best-bowling-economy', 'Best Bowling Strike Rate': 'best-bowling-strike-rate'} + +# Function to generate request url based on user choice +def generate_url(): + category_choice = category.get() + year_choice = year.get() + if (year_choice == 'All time'): + year_choice = 'all-time' + category_slug = categories[category_choice] + url = 'https://www.iplt20.com/stats/{}/{}'.format( + year_choice, category_slug) + return url + +# Function to scrape results based on request url +def scrape_results(): + url = generate_url() + page = requests.get(url) + + # Start scraping resultant html data + soup = BeautifulSoup(page.content, 'html.parser') + results = soup.find( + "table", {"class": "table table--scroll-on-tablet top-players"}) + rows = results.findChildren('tr') + + table_data = [] + row_values = [] + # Append player data into a list + for row in rows: + cells = row.findChildren(['th', 'td']) + for cell in cells: + value = cell.text.strip() + value = " ".join(value.split()) + row_values.append(value) + table_data.append(row_values) + row_values = [] + + # Formatting the data stored in the list + p_records = "" + for player in table_data[:51]: + single_record = "" + for cell in player: + format_cell = "{:<40}" + single_record += format_cell.format(cell[:40]) + single_record += "\n" + p_records += single_record + + # Adding the formatted data into tkinter GUI + query_label['text'] = p_records + + # Creating tkinter window window = tk.Tk() -window.title('Combobox') +window.title('IPL Statistics') window.geometry('800x850') # label text for title @@ -18,24 +73,19 @@ font=("Helvetica", 15)).grid(column=0, row=5, padx=10, pady=25) - -def getSearchvals(): - print(category.get(), year.get()) - - # Combobox creation category = ttk.Combobox( window, state='readonly') year = ttk.Combobox( window, width="27," state='readonly') -submit_btn = ttk.Button(window, , command=getSearchvals) +submit_btn = ttk.Button(window, , command=scrape_results) # Adding combobox drop down list category['values'] = ('Most Runs', 'Most Fours', 'Most Sixes', 'Most Fifties', 'Most Centuries', 'Highest Scores', 'Most Wickets', 'Most Maidens', 'Most Dot Balls', 'Best Bowling Average', 'Best Bowling Economy', 'Best Bowling Strike Rate') -year['values'] = ('2020', '2019', '2018', '2017', '2016', +year['values'] = ('All time', '2020', '2019', '2018', '2017', '2016', '2015', '2014', '2013', '2012', '2011', '2010', '2009', '2008') category.grid(column=1, row=5, padx=10) @@ -49,11 +99,8 @@ def getSearchvals(): frame = ttk.Frame(window) frame.place(relx=0.50, rely=0.12, relwidth="0.98," relheight="0.90," anchor="n") -# global query_label query_label = ttk.Label( - frame, anchor="nw", justify="left", The" workspace above has a list of tasks/ideas that could serve as utilities for managing OpenAPI specifications eg. cleanup tasks, adding default responses.\n")*50) + frame, anchor="nw", justify="left", ) query_label.grid(row=7, columnspan=2) -# query_label['text'] = "The workspace above has a list of tasks/ideas that could serve as utilities for managing OpenAPI specifications eg. cleanup tasks, adding default responses." - window.mainloop() From a31fc407455b6623f7b5e7749bb72d1e951e4cee Mon Sep 17 00:00:00 2001 From: "LAPTOP-SNSEHSAR\\ayush" Date: Fri, 9 Apr 2021 11:49:52 +0530 Subject: [PATCH 09/16] requirements files added --- IPL Statistics GUI/requirements.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 IPL Statistics GUI/requirements.txt diff --git a/IPL Statistics GUI/requirements.txt b/IPL Statistics GUI/requirements.txt new file mode 100644 index 0000000000..a98ae430c4 --- /dev/null +++ b/IPL Statistics GUI/requirements.txt @@ -0,0 +1,2 @@ +requests +beautifulsoup4 \ No newline at end of file From 451308aac4ba00621d7b210897b42a3b9d5294f5 Mon Sep 17 00:00:00 2001 From: "LAPTOP-SNSEHSAR\\ayush" Date: Fri, 9 Apr 2021 11:54:45 +0530 Subject: [PATCH 10/16] Readme file added --- IPL Statistics GUI/README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 IPL Statistics GUI/README.md diff --git a/IPL Statistics GUI/README.md b/IPL Statistics GUI/README.md new file mode 100644 index 0000000000..3bdaa9d2b9 --- /dev/null +++ b/IPL Statistics GUI/README.md @@ -0,0 +1,26 @@ +# IPL Statistics GUI +Running this Script would allow the user see IPL statistics from various categories like most runs , most wickets etc from all seasons (2008 - 2020) + +## Setup instructions +In order to run this script, you need to have Python and pip installed on your system. After you're done installing Python and pip, run the following command from your terminal to install the requirements from the same folder (directory) of the project. +``` +pip install -r requirements.txt +``` +After satisfying all the requirements for the project, Open the terminal in the project folder and run +``` +python ipl.py +``` +or +``` +python3 ipl.py +``` +depending upon the python version. Make sure that you are running the command from the same virtual environment in which the required modules are installed. + +## Output + +The user can choose the statistics they want to analyse as shown in the sample screenshot below + +![IPL Statistics GUI](https://i.postimg.cc/d3YBQWL5/ipl-Stats.png) + +## Author +[Ayush Jain](https://github.com/Ayushjain2205) \ No newline at end of file From 6b16b1a94c346da2024ec91475e23d77c5aa7191 Mon Sep 17 00:00:00 2001 From: pankaj892 <31444506+pankaj892@users.noreply.github.com> Date: 2021年4月10日 14:24:41 +0530 Subject: [PATCH 11/16] Update Battery-Notification.py --- Battery-Notification/Battery-Notification.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Battery-Notification/Battery-Notification.py b/Battery-Notification/Battery-Notification.py index c794872916..99040f5d0d 100644 --- a/Battery-Notification/Battery-Notification.py +++ b/Battery-Notification/Battery-Notification.py @@ -2,14 +2,20 @@ from plyer import notification import time #From psutil we import sensors battery class which gives us battery percentage +threshold = int(input('Enter the threshold: ')) while(True): battery = psutil.sensors_battery() percent = battery.percent - notification.notify( - title = "Battery Percentage", - message = str(percent) + "% Battery Remaining", - timeout = 5 - ) - #After every 60 minutes it will show the battery percentage via a notification - time.sleep(60) + time.sleep(60*2) + battery = psutil.sensors_battery() + cur_per = battery.percent + change = cur_per - percent + diff = abs(change) + #We calculate the change in the battery and show notification if battery level increases or decreases + if(diff>= threshold): + notification.notify( + title = "Battery Percentage", + message = str(percent) + "% Battery Remaining", + timeout = 5 + ) continue From 52a3abc3669ff6efb9c6648ce31d94f14d6e2bfb Mon Sep 17 00:00:00 2001 From: "LAPTOP-SNSEHSAR\\ayush" Date: 2021年4月10日 15:32:07 +0530 Subject: [PATCH 12/16] player data allignment fix --- IPL Statistics GUI/ipl.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/IPL Statistics GUI/ipl.py b/IPL Statistics GUI/ipl.py index aa3764a20b..c2e159e40a 100644 --- a/IPL Statistics GUI/ipl.py +++ b/IPL Statistics GUI/ipl.py @@ -49,13 +49,16 @@ def scrape_results(): for player in table_data[:51]: single_record = "" for cell in player: - format_cell = "{:<40}" - single_record += format_cell.format(cell[:40]) + format_cell = "{:<20}" + single_record += format_cell.format(cell[:20]) single_record += "\n" p_records += single_record # Adding the formatted data into tkinter GUI - query_label['text'] = p_records + query_label.config(state=tk.NORMAL) + query_label.delete(1.0,"end") + query_label.insert(1.0,p_records) + query_label.config(state=tk.DISABLED) # Creating tkinter window @@ -99,8 +102,7 @@ def scrape_results(): frame = ttk.Frame(window) frame.place(relx=0.50, rely=0.12, rel relheight="0.90," anchor="n") -query_label = ttk.Label( - frame, anchor="nw", justify="left", ) +query_label = tk.Text( frame,height="52",width="500") query_label.grid(row=7, columnspan=2) window.mainloop() From b94ba810934f5f4a8ab810654e541b0f31ce892f Mon Sep 17 00:00:00 2001 From: "LAPTOP-SNSEHSAR\\ayush" Date: 2021年4月10日 15:33:51 +0530 Subject: [PATCH 13/16] 2021 support added --- IPL Statistics GUI/ipl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IPL Statistics GUI/ipl.py b/IPL Statistics GUI/ipl.py index c2e159e40a..f5aafb607f 100644 --- a/IPL Statistics GUI/ipl.py +++ b/IPL Statistics GUI/ipl.py @@ -88,7 +88,7 @@ def scrape_results(): category['values'] = ('Most Runs', 'Most Fours', 'Most Sixes', 'Most Fifties', 'Most Centuries', 'Highest Scores', 'Most Wickets', 'Most Maidens', 'Most Dot Balls', 'Best Bowling Average', 'Best Bowling Economy', 'Best Bowling Strike Rate') -year['values'] = ('All time', '2020', '2019', '2018', '2017', '2016', +year['values'] = ('All time','2021', '2020', '2019', '2018', '2017', '2016', '2015', '2014', '2013', '2012', '2011', '2010', '2009', '2008') category.grid(column=1, row=5, padx=10) From 1152f09a4619669f48810c8fc5f1e7f33255aa5a Mon Sep 17 00:00:00 2001 From: "LAPTOP-SNSEHSAR\\ayush" Date: 2021年4月10日 15:36:09 +0530 Subject: [PATCH 14/16] readme updated with new UI screenshot --- IPL Statistics GUI/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IPL Statistics GUI/README.md b/IPL Statistics GUI/README.md index 3bdaa9d2b9..a8a1a218cc 100644 --- a/IPL Statistics GUI/README.md +++ b/IPL Statistics GUI/README.md @@ -20,7 +20,7 @@ depending upon the python version. Make sure that you are running the command fr The user can choose the statistics they want to analyse as shown in the sample screenshot below -![IPL Statistics GUI](https://i.postimg.cc/d3YBQWL5/ipl-Stats.png) +![IPL Statistics GUI](https://i.postimg.cc/nLdgKhWQ/ipl-stats.png) ## Author [Ayush Jain](https://github.com/Ayushjain2205) \ No newline at end of file From 0d866568e2c9c9377ba4a964a0271b8661489464 Mon Sep 17 00:00:00 2001 From: pankaj892 <31444506+pankaj892@users.noreply.github.com> Date: 2021年4月11日 12:25:18 +0530 Subject: [PATCH 15/16] Update Battery-Notification/Battery-Notification.py Co-authored-by: Kaustubh Gupta --- Battery-Notification/Battery-Notification.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Battery-Notification/Battery-Notification.py b/Battery-Notification/Battery-Notification.py index 99040f5d0d..a7d74aa920 100644 --- a/Battery-Notification/Battery-Notification.py +++ b/Battery-Notification/Battery-Notification.py @@ -3,8 +3,24 @@ import time #From psutil we import sensors battery class which gives us battery percentage threshold = int(input('Enter the threshold: ')) + +battery = psutil.sensors_battery() +percent = battery.percent + while(True): battery = psutil.sensors_battery() + cur_per = battery.percent + change = cur_per - percent + diff = abs(change) + #We calculate the change in the battery and show notification if battery level increases or decreases + if(diff>= threshold): + notification.notify( + title = "Battery Percentage", + message = str(cur_per) + "% Battery Remaining", + timeout = 5 + ) + percent = cur_per + battery = psutil.sensors_battery() percent = battery.percent time.sleep(60*2) battery = psutil.sensors_battery() From 58733869ffb60fe59ac90f15eb03c102719e077d Mon Sep 17 00:00:00 2001 From: pankaj892 <31444506+pankaj892@users.noreply.github.com> Date: 2021年4月11日 12:44:39 +0530 Subject: [PATCH 16/16] Update Battery-Notification.py --- Battery-Notification/Battery-Notification.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Battery-Notification/Battery-Notification.py b/Battery-Notification/Battery-Notification.py index a7d74aa920..a7c04044aa 100644 --- a/Battery-Notification/Battery-Notification.py +++ b/Battery-Notification/Battery-Notification.py @@ -20,18 +20,4 @@ timeout = 5 ) percent = cur_per - battery = psutil.sensors_battery() - percent = battery.percent - time.sleep(60*2) - battery = psutil.sensors_battery() - cur_per = battery.percent - change = cur_per - percent - diff = abs(change) - #We calculate the change in the battery and show notification if battery level increases or decreases - if(diff>= threshold): - notification.notify( - title = "Battery Percentage", - message = str(percent) + "% Battery Remaining", - timeout = 5 - ) continue

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