Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Domains/CompetitiveProgramming/Programs/Python/Notepad/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
**Contributor:** GayatriVitkar



# Python Notepad 📝

A simple and lightweight **Notepad application** built in Python using Tkinter.
This application allows users to create, open, edit, and save text files with a clean and intuitive interface. Perfect for basic text editing and learning GUI programming in Python.



## 🔹 Features

- **Create New File**: Start a new text document from scratch.
- **Open File**: Open existing `.txt` files for editing.
- **Save File**: Save your work to a file on your system.
- **Cut, Copy, Paste**: Standard text editing features for convenience.
- **Simple GUI**: Built using Python's Tkinter library for an easy-to-use interface.
- **Lightweight & Fast**: Minimal resources required, runs smoothly on any system with Python installed.



## 🔹 How to Run

1. Make sure **Python 3.x** is installed on your system.
2. Navigate to the project folder where `notepad.py` is located.
3. Run the application:
python notepad.py



Note: Tkinter usually comes pre-installed with Python. If not, install it using:
pip install tk
116 changes: 116 additions & 0 deletions Domains/CompetitiveProgramming/Programs/Python/Notepad/notepad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
from tkinter import *
from tkinter.messagebox import showinfo
from tkinter.filedialog import askopenfilename,asksaveasfilename
import os

def newFile():
global file
root.title("My Notepad")
file=None
TextArea.delete(1.0,END) #1.0 first line 0th character

def openFile():
global file
file=askopenfilename(defaultextension=".txt",filetypes=[("All Files","*.*"),
("Text Documents","*.txt")])
if file == "":
file=None

else:
root.title(os.path.basename(file)+" - Notepad")
TextArea.delete(1.0,END)
f = open(file,"r")
TextArea.insert(1.0,f.read())
f.close()

def saveFile():
global file
if file == None:
file = asksaveasfilename(initialfile='MyNoteFile.txt',defaultextension=".txt",filetypes=[("All Files","*.*"),
("Text Documents","*.txt")])
if file == "":
file=None

else:
#save s new file
f = open(file,"w")
f.write(TextArea.get(1.0,END))
f.close()

root.title(os.path.basename(file) + " - Notepad" )
print("File Saved")

else:
# save the file
f = open(file,"w")
f.write(TextArea.get(1.0,END))
f.close()

def quitApp():
root.destroy()

def cut():
TextArea.event_generate(("<<Cut>>")) #automatic handle internally cut

def copy():
TextArea.event_generate(("<<Copy>>")) #automatic handle internally cut

def paste():
TextArea.event_generate(("<<Paste>>")) #automatic handle internally cut


def about():
showinfo("Notepad","Notepad By Gayatri")

if __name__=='__main__':
root=Tk()
root.title("My Notepad")
root.geometry("800x600")

#Add TextArea
TextArea = Text(root,font="lucida 13")
file = None
TextArea.pack(expand=True,fill=BOTH)

# Lets create menu bar
MenuBar = Menu(root) #Horizontal menu
# File Menu Starts
FileMenu = Menu(MenuBar,tearoff=0)

# To Open new file
FileMenu.add_command(label="New",command=newFile)

# To open already exixting file

FileMenu.add_command(label="Open",command=openFile)

#To save the current file
FileMenu.add_command(label="Save",command=saveFile)
FileMenu.add_separator()
FileMenu.add_command(label="Exit",command=quitApp)
MenuBar.add_cascade(label="File",menu = FileMenu)

# Edit Menu Starts
EditMenu = Menu(MenuBar,tearoff=0)

# To give feature of cut,copy and paste

EditMenu.add_command(label = "Cut",command=cut)
EditMenu.add_command(label = "Copy",command=copy)
EditMenu.add_command(label = "Paste",command=paste)

MenuBar.add_cascade(label="Edit",menu=EditMenu)

HelpMenu = Menu(MenuBar,tearoff=0)
HelpMenu.add_command(label="About Notepad",command=about)
MenuBar.add_cascade(label="Help",menu=HelpMenu)

# Edit menu ends
root.config(menu=MenuBar)
#Adding ScrollBar using rules from Tkinter lec 22
Scroll=Scrollbar(TextArea)
Scroll.pack(side=RIGHT,fill=Y)
Scroll.config(command=TextArea.yview)
TextArea.config(yscrollcommand=Scroll.set)

root.mainloop()
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
**Contributor:** GayatriVitkar

# Tic Tac Toe Game 🎮

A simple Tic Tac Toe game built in Python allowing two players to play locally in the console.

## Features
- Two-player gameplay
- Clear console interface
- Option to restart the game after finishing

## How to Play
1. Run the Python script: `python tictactoe.py`
2. Player X starts and chooses a position (1-9).
3. Player O plays next.
4. The game continues until one player wins or the board is full.

## Contributing
Feel free to improve the game or add new features!
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import tkinter as tk
from tkinter import messagebox

class TicTacToe:
def __init__(self, root):
# Initialize the main application window
self.root = root
self.root.title("Tic Tac Toe")

# Set the current player and initialize the board state
self.current_player = "X"
self.board = [""] * 9

# List to hold button references for the game board
self.buttons = []
self.create_board()

def create_board(self):
# Create a frame to hold the game board buttons
frame = tk.Frame(self.root, bg="lightblue") # Add background color for aesthetic
frame.pack(padx=10, pady=10)

# Create 9 buttons (3x3 grid) for the board
for i in range(9):
button = tk.Button(
frame, text="", font=("Arial", 24, "bold"), width=5, height=2,
bg="white", fg="black", command=lambda i=i: self.on_click(i), relief="raised" # Pass button index to the click handler
)
button.grid(row=i//3, column=i%3, padx=5, pady=5) # Position button in the grid
self.buttons.append(button)

# Add a label to display the current player's turn
self.turn_label = tk.Label(
self.root, text=f"Player {self.current_player}'s Turn", font=("Arial", 16), bg="lightblue"
)
self.turn_label.pack(pady=5)

# Add a restart button below the game board
self.restart_button = tk.Button(
self.root, text="Restart Game", font=("Arial", 14, "bold"), bg="orange", fg="white",
command=self.restart_game
)
self.restart_button.pack(pady=10)

def on_click(self, index):
# Handle a button click event
if self.board[index] == "": # Ensure the button has not already been clicked
self.board[index] = self.current_player
self.buttons[index].config(text=self.current_player, fg="blue" if self.current_player == "X" else "red") # Update button text

if self.check_winner(): # Check if the current player has won
messagebox.showinfo("Game Over", f"Player {self.current_player} wins!")
self.turn_label.config(text=f"Player {self.current_player} wins!")
self.disable_buttons() # Disable further interaction with the board
elif "" not in self.board: # Check for a draw condition
messagebox.showinfo("Game Over", "It's a draw!")
self.turn_label.config(text="It's a draw!")
else:
# Switch to the other player
self.current_player = "O" if self.current_player == "X" else "X"
self.turn_label.config(text=f"Player {self.current_player}'s Turn")

def check_winner(self):
# Define winning patterns (rows, columns, diagonals)
win_patterns = [
[0, 1, 2], [3, 4, 5], [6, 7, 8], # Rows
[0, 3, 6], [1, 4, 7], [2, 5, 8], # Columns
[0, 4, 8], [2, 4, 6] # Diagonals
]

# Check if any winning pattern is satisfied
for pattern in win_patterns:
if self.board[pattern[0]] == self.board[pattern[1]] == self.board[pattern[2]] != "":
return True
return False

def disable_buttons(self):
# Disable all buttons to prevent further interaction
for button in self.buttons:
button.config(state="disabled")

def restart_game(self):
# Reset the game to its initial state
self.current_player = "X" # Reset to player X
self.board = [""] * 9 # Clear the board state
self.turn_label.config(text=f"Player {self.current_player}'s Turn") # Update turn label
for button in self.buttons:
button.config(text="", state="normal", bg="white") # Clear button text and enable them

if __name__ == "__main__":
# Create the main application window and run the game
root = tk.Tk()
root.configure(bg="lightblue") # Set a background color for the main window
game = TicTacToe(root)
root.mainloop()
104 changes: 104 additions & 0 deletions Domains/Frontend/MiniProjects/NewsFlash/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
**Contributor:** GayatriVitkarcd

📝 Description

NewsFlash is a responsive and modern web application that delivers the latest news headlines from multiple categories in real-time using the NewsAPI.

The project has a clean glassmorphism-inspired interface with smooth hover effects, animated loading transitions, and a seamless infinite scroll experience.
Users can explore top news, search for specific topics, and filter articles by categories like Technology, Sports, Business, Entertainment, and more.

Each news card contains a thumbnail, headline, short description, source, and a “Read More” button that opens the full article in a new tab.

🎯 Features

🌍 Live News Fetching: Displays updated news headlines using NewsAPI.

🔎 Search Functionality: Find news instantly by typing keywords.

🏷️ Category Filters: Switch easily between trending topics.

♾️ Infinite Scroll: Automatically loads more news as you scroll.

💎 Responsive Glassmorphism UI: Works smoothly on all screen sizes.

⚡ Fast & Lightweight: Built using pure HTML, CSS, and vanilla JavaScript.

🛠️ Tech Stack

HTML5: Structure and layout of the web pages.

CSS3: Custom responsive design with glassmorphism and animations.

JavaScript (Fetch API): Fetches and dynamically displays live news content.

🚀 How to Run
🖥️ Method 1: Open in Browser

Download or clone this repository.

Open index.html directly in your browser.

⚡ Method 2: Live Server (Recommended)

Open project in VS Code.

Right-click index.html → Open with Live Server.

App runs locally at http://localhost:5500.

📁 Project Structure
NewsFlash/
├── index.html # Main HTML file
├── style.css # Styling and layout
├── script.js # JavaScript logic and API integration
├── README.md # Documentation
└── assets/ # Images or icons used

📚 Learning Outcomes

Working with public APIs (NewsAPI)

Asynchronous JavaScript (Fetch, async/await)

DOM Manipulation and Dynamic Rendering

Responsive UI Design

Event Handling and Search Filtering

Implementing Infinite Scroll Mechanism

🐛 Known Issues

API requests may fail if the free API limit is reached.

Slow networks can cause delayed image loading.

Some articles might not contain images or descriptions from the API.

🚀 Future Enhancements

Add dark/light mode toggle.

Save favorite articles using local storage.

Add “Top Stories by Country” filter.

Implement voice-based news search.

Add a simple offline PWA version.

📄 License

MIT License – Free for learning and personal use.

🤝 Contributing

This project is part of ProjectHive Frontend Domain.
Feel free to:

Fork and enhance the app

Report bugs or suggest improvements

Use it for your portfolio or learning practice
Loading
Loading