Skip to content

Commit 6b742c7

Browse files
Merge pull request avinashkranjan#2429 from Avdhesh-Varshney/advice
[GSSoC'23] Advisor Application Ready
2 parents 185eb74 + 624832c commit 6b742c7

File tree

3 files changed

+65
-1
lines changed

3 files changed

+65
-1
lines changed

Advisor_App/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# ADVISOR APPLICATION
2+
3+
This is a Python Script which gives you advice and motivation quote lines.
4+
5+
---
6+
7+
## Requirements
8+
9+
For this script to run you need to have requests packages installed
10+
11+
Run the command in terminal to install package
12+
13+
```
14+
$ pip install requests
15+
```
16+
```
17+
$ pip install tkinter
18+
```
19+
Run the program using command
20+
21+
```
22+
$ python advice.py
23+
```
24+
25+
## Created By
26+
27+
[Avdhesh Varshney](https://github.com/Avdhesh-Varshney)
28+
29+
<br>
30+
31+
**Thanks for using this program**
32+

Advisor_App/advice.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Importing libraries
2+
import requests
3+
import tkinter as tk
4+
from tkinter import messagebox
5+
6+
# Fetching advice from the advice api
7+
def advice():
8+
try:
9+
res = requests.get("https://api.adviceslip.com/advice").json()
10+
advice_text.set(res["slip"]["advice"])
11+
except requests.exceptions.RequestException:
12+
messagebox.showerror("Error", "Failed to fetch advice. Please check your internet connection.")
13+
14+
# Create the main window
15+
root = tk.Tk()
16+
root.title("Random Advisor Application")
17+
18+
# Create and configure widgets
19+
advice_text = tk.StringVar()
20+
advice_label = tk.Label(root, textvariable=advice_text, wraplength=400, font=("Arial", 14))
21+
get_advice_button = tk.Button(root, text="Get Advice", command=advice)
22+
23+
# Pack widgets
24+
advice_label.pack(pady=20)
25+
get_advice_button.pack(pady=10)
26+
27+
# Initial advice fetching
28+
advice()
29+
30+
# Run the main event loop
31+
root.mainloop()

SCRIPTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,5 @@
118118
| 109\. | Fetch Contributions | This script is a Python tool that fetches pull requests made by a user in a GitHub organization. | [Take Me](./Fetch_Contributions/) | [Sabhi Sharma](https//github.com/sabhisharma-ise)
119119
| 109\. | Domain Name Availability Checker | This script is a Python tool that allows you to check the availability of domain names using the GoDaddy API. | [Take Me](./Domain_Name_Availability/) | [Sabhi Sharma](https//github.com/sabhisharma-ise)
120120
| 110\. | Automatic Spelling Checker and Corrector | This Script is used to detect spelling errors in a text and correct them if the user wishes to do so. | [Take Me](./Automatic_Spelling_Checker_Corrector/) | [Sabhi Sharma](https//github.com/sabhisharma-ise)
121-
| 111\. | File Searcher | The File Search script is a Python tool that allows you to search for files with a specific extension in a directory. It recursively searches through all subdirectories of the specified directory and returns a list of files that match the provided file extension. | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/File\Search) | [Srujana Vanka](https://github.com/srujana-16)
121+
| 111\. | File Searcher | The File Search script is a Python tool that allows you to search for files with a specific extension in a directory. It recursively searches through all subdirectories of the specified directory and returns a list of files that match the provided file extension. | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/File\Search) | [Srujana Vanka](https://github.com/srujana-16)
122+
| 112\. | Advisor App | This python script allows user to give so many advices and motivation quote lines. | [Take Me](./Advisor_App) | [Avdhesh Varshney](https://github.com/Avdhesh-Varshney)

0 commit comments

Comments
 (0)