Skip to content

Commit

Permalink
Merge pull request #303 from Sai-Uttej-R/main
Browse files Browse the repository at this point in the history
Added new:the Random Quote Generator project
  • Loading branch information
Mrinank-Bhowmick authored Aug 31, 2023
2 parents e12f4f4 + 3b493fa commit 0ef0994
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 0 deletions.
93 changes: 93 additions & 0 deletions projects/Random-Quote-Generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
```markdown
# Random Quote Generator

## Overview

The Random Quote Generator is a simple Python application that fetches and displays random quotes from an online API. Users can click a button to get a new inspiring or funny quote. This project is designed for beginners and includes a graphical user interface (GUI) created using the Tkinter library for a user-friendly experience.

![Random Quote Generator](screenshot.png)

## Features

- Fetch and display a random quote with the click of a button.
- Show the quote along with the author's name.
- Handle internet connection errors gracefully.
- Simple and intuitive GUI for a user-friendly experience.

## Dependencies

- Python 3.x
- Tkinter library (usually included with Python)
- Requests library (for making HTTP requests)

## Getting Started

1. Clone this repository to your local machine.

```bash
git clone https://github.com/your-username/random-quote-generator.git
```

2. Navigate to the project directory.

```bash
cd random-quote-generator
```

3. Install the `requests` library if you haven't already.

```bash
pip install requests
```

4. Run the Python script.

```bash
python random_quote_generator.py
```

5. The GUI will appear, displaying an initial random quote. Click the "Get a New Quote" button to fetch and display a new quote.

## How to Contribute

We welcome contributions to improve and expand this Random Quote Generator project. If you'd like to contribute, follow these steps:

1. Fork the repository on GitHub.

2. Clone your forked repository to your local machine.

```bash
git clone https://github.com/your-username/random-quote-generator.git
```

3. Create a new branch for your feature or bug fix.

```bash
git checkout -b feature/your-feature-name
```

4. Make your changes and commit them with descriptive commit messages.

5. Push your changes to your GitHub repository.

```bash
git push origin feature/your-feature-name
```

6. Create a pull request from your branch to the main repository.

7. Wait for your pull request to be reviewed and merged.

## Acknowledgments

- Thanks to [Quotable API](https://quotable.io/) for providing the quotes.

## Contact

If you have any questions, suggestions, or issues, please feel free to contact us at [saiuttej.r@protonmail.com].

Happy quoting! 🚀
```
Feel free to customize it further to fit your project's specific details and needs.

This README provides a clear and organized guide for users and potential contributors to understand and interact with your Random Quote Generator project. If you have any more questions or need further assistance, just hit me up, pal!
32 changes: 32 additions & 0 deletions projects/Random-Quote-Generator/random_quote_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import requests
import tkinter as tk

# Function to fetch and display a random quote
def get_random_quote():
try:
response = requests.get("https://api.quotable.io/random")
data = response.json()
quote = data["content"]
author = data["author"]
quote_text.set(f'"{quote}" - {author}')
except requests.exceptions.RequestException as e:
quote_text.set("Failed to fetch a quote. Check your internet connection.")

# Create the main window
root = tk.Tk()
root.title("Random Quote Generator")

# Create a label to display the quote
quote_text = tk.StringVar()
quote_label = tk.Label(root, textvariable=quote_text, wraplength=300, font=("Helvetica", 12))
quote_label.pack(pady=20)

# Create a button to get a new quote
new_quote_button = tk.Button(root, text="Get a New Quote", command=get_random_quote)
new_quote_button.pack()

# Fetch and display an initial random quote
get_random_quote()

# Start the GUI main loop
root.mainloop()

0 comments on commit 0ef0994

Please sign in to comment.