Skip to content

Commit 1b04329

Browse files
Merge branch 'avinashkranjan:master' into low_battery_scripy
2 parents 6183bf8 + 547c343 commit 1b04329

File tree

11 files changed

+303
-4
lines changed

11 files changed

+303
-4
lines changed

Anime-Tracker/anime_tracker.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ def details(soup):
4444

4545
def entry():
4646
print("\nType complete name>>\n")
47-
anime_name = input(
48-
"[+] Enter the name of the Anime : ").strip().title().replace(
49-
" ", "-")
47+
anime_name = input("Enter the name of the anime : ")
48+
anime_name = (" ".join(anime_name.split())).title().replace(" ", "-")
5049

5150
print("\n")
5251
print(anime_name)

GUI-Password-Generator/generator.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import random
2+
import pyperclip
3+
from tkinter import *
4+
from tkinter.ttk import *
5+
6+
def getStrength():
7+
entry.delete(0, END)
8+
length = var1.get()
9+
lower = "abcdefghijklmnopqrstuvwxyz"
10+
upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
11+
digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 !@#$%^&*()"
12+
password = ""
13+
14+
# if strength selected is low
15+
if var.get() == 1:
16+
for i in range(0, length):
17+
password = password + random.choice(lower)
18+
return password
19+
20+
# if strength selected is medium
21+
elif var.get() == 0:
22+
for i in range(0, length):
23+
password = password + random.choice(upper)
24+
return password
25+
26+
# if strength selected is strong
27+
elif var.get() == 3:
28+
for i in range(0, length):
29+
password = password + random.choice(digits)
30+
return password
31+
else:
32+
print("Please choose an option")
33+
34+
35+
# Function for generation of password
36+
def generate():
37+
password1 = getStrength()
38+
entry.insert(10, password1)
39+
40+
41+
# Function for copying password to clipboard
42+
def copy():
43+
random_password = entry.get()
44+
pyperclip.copy(random_password)
45+
46+
47+
# create GUI window
48+
root = Tk()
49+
var = IntVar()
50+
var1 = IntVar()
51+
52+
53+
54+
# Title of the GUI window
55+
root.title("Password Generator")
56+
57+
# create label for length of password
58+
c_label = Label(root, text="Length")
59+
c_label.grid(row=0)
60+
copy_button = Button(root, text="Copy", command=copy)
61+
copy_button.grid(row=0, column=2)
62+
generate_button = Button(root, text="Generate", command=generate)
63+
generate_button.grid(row=0, column=3)
64+
65+
radio_low = Radiobutton(root, text="Low", variable=var, value=1)
66+
radio_low.grid(row=1, column=2, sticky='E')
67+
radio_middle = Radiobutton(root, text="Medium", variable=var, value=0)
68+
radio_middle.grid(row=1, column=3, sticky='E')
69+
radio_strong = Radiobutton(root, text="Strong", variable=var, value=3)
70+
radio_strong.grid(row=1, column=4, sticky='E')
71+
combo = Combobox(root, textvariable=var1)
72+
combo['values'] = (8, 9, 10, 11, 12, 13, 14, 15, 16,
73+
17, 18, 19, 20, 21, 22, 23, 24, 25,
74+
26, 27, 28, 29, 30, 31, 32)
75+
combo.current(0)
76+
combo.bind('<<ComboboxSelected>>')
77+
combo.grid(column=1, row=0)
78+
Random_password = Label(root, text="Generated password",padding=5)
79+
Random_password.grid(row=1)
80+
entry = Entry(root)
81+
entry.grid(row=1, column=1)
82+
83+
84+
##run the GUI continuously
85+
root.mainloop()

GUI-Password-Generator/readme.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Password Generator tool
2+
3+
This is a GUI app that Generates a random password
4+
5+
Features:
6+
Length can be selected
7+
Strength can be selected
8+
Copy to clipboard button
9+
10+
11+
modules needed: pyperclip
12+
>pip install pyperclip
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pyperclip==1.8.2

GUI-Stopwatch/readme.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# GUI CALCULATOR
2+
3+
This script user Tkinter to provide a Graphical User Interface.
4+
5+
No Requirements because Tkinter and time is inbuilt
6+
7+
These are customizable
8+
9+
1. The refresh rate (how fast the display updates)
10+
2. Colours: background,button colour
11+
3. Text: font, size, colour
12+
4. The size of the GUI window can be adjusted during execution
13+
5. The default size of the GUI window can be adjusted in the script
14+
6. The button text, position, size

GUI-Stopwatch/stopwatch.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
## tkinter and time modules are inbuilt
2+
from tkinter import *
3+
import time
4+
5+
def run():
6+
global root
7+
root = Tk()
8+
root.title("Stopwatch APP")
9+
width = 400
10+
height = 160
11+
screen_width = root.winfo_screenwidth()
12+
screen_height = root.winfo_screenheight()
13+
x = (screen_width / 2) - (width / 2)
14+
y = (screen_height / 2) - (height / 2)
15+
root.geometry("%dx%d+%d+%d" % (width, height, x, y))
16+
Top = Frame(root)
17+
Top.pack(side=TOP)
18+
stopWatch = StopWatch(root)
19+
stopWatch.pack(side=TOP,pady=15)
20+
Bottom = Frame(root, width=400)
21+
Bottom.pack(side=BOTTOM)
22+
Start = Button(Bottom, text='Start', command=stopWatch.Start, width=20, height=2, bg="green")
23+
Start.pack(side=LEFT)
24+
Stop = Button(Bottom, text='Stop', command=stopWatch.Stop, width=20, height=2, bg="red")
25+
Stop.pack(side=LEFT)
26+
Reset = Button(Bottom, text='Reset', command=stopWatch.Reset, width=15, height=2)
27+
Reset.pack(side=LEFT)
28+
root.config(bg="black")
29+
root.mainloop()
30+
31+
32+
class StopWatch(Frame):
33+
def __init__(self, parent=None, **kw):
34+
'''When object is initialized'''
35+
Frame.__init__(self, parent, kw)
36+
self.startTime = 0.0
37+
self.nextTime = 0.0
38+
self.onRunning = 0
39+
self.timestr = StringVar()
40+
self.MakeWidget()
41+
def Updater(self):
42+
'''update the time shown'''
43+
self.nextTime = time.time() - self.startTime
44+
self.SetTime(self.nextTime)
45+
self.timer = self.after(1, self.Updater)
46+
def MakeWidget(self):
47+
'''make widget for displaying time'''
48+
timeText = Label(self, textvariable=self.timestr, font=("callibri", 50), fg="yellow", bg="grey")
49+
self.SetTime(self.nextTime)
50+
timeText.pack(fill=X, expand=NO, pady=2, padx=2)
51+
def SetTime(self, nextElap):
52+
'''set time that is to be displayed'''
53+
mins = int(nextElap / 60)
54+
secs = int(nextElap - mins * 60.0)
55+
milisecs = int((nextElap - mins * 60.0 - secs) * 100)
56+
self.timestr.set('%02d:%02d:%02d' % (mins, secs, milisecs))
57+
def Start(self):
58+
'''start stopwatch'''
59+
if not self.onRunning:
60+
self.startTime = time.time() - self.nextTime
61+
self.Updater()
62+
self.onRunning = 1
63+
def Stop(self):
64+
'''stop stopwatch'''
65+
if self.onRunning:
66+
self.after_cancel(self.timer)
67+
self.nextTime = time.time() - self.startTime
68+
self.SetTime(self.nextTime)
69+
self.onRunning = 0
70+
def Reset(self):
71+
'''reset stopwatch'''
72+
self.startTime = time.time()
73+
self.nextTime = 0.0
74+
self.SetTime(self.nextTime)
75+
76+
77+
78+
79+
80+
if __name__ == '__main__':
81+
run()

Image Manipulation Script/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# File Downloader Script
2+
3+
4+
The script provided earlier is an "Image Manipulation Script" written in Python using the Pillow library. It allows you to perform basic image manipulations such as resizing, rotating, and flipping an image.
5+
6+
The script consists of three main functions:
7+
8+
-resize_image(): Resizes an input image to a specified size.
9+
-rotate_image(): Rotates an input image by a specified number of degrees.
10+
-flip_image(): Flips an input image based on a specified flip mode.
11+
12+
<br>
13+
14+
## Instructions 📝
15+
16+
### Step 1:
17+
18+
Save the Script: Save the script code provided earlier in a file with the desired name, such as image_manipulation.py. Make sure to save it with the .py extension, indicating that it is a Python script.
19+
### Step 2:
20+
21+
Install Dependencies: Ensure that you have the necessary dependencies installed. In this case, the script relies on the Pillow library. You can install it using the pip package manager. Open a command prompt or terminal and run the following command:
22+
23+
pip install Pillow
24+
25+
### Step 3:
26+
Run the Script: Open a command prompt or terminal, navigate to the directory where the script is saved, and run the following command:
27+
python image_manipulation.py
28+
29+
### Step 4:
30+
31+
Check the Output: The script will perform the specified image manipulations based on the example usage section. The resized, rotated, and flipped images will be saved to the specified output file paths. You will see success messages for each manipulation indicating that the images have been processed and saved successfully.
32+
33+
34+
<br>
35+
36+
<hr>
37+
38+
> **Warning**
39+
>
40+
>Remember to update the file paths and manipulation parameters in the example usage section to match your specific needs.
41+
42+
Ensure that you have the Pillow library installed (pip install Pillow) before running the script.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from PIL import Image
2+
3+
def resize_image(input_image, output_image, new_size):
4+
image = Image.open(input_image)
5+
resized_image = image.resize(new_size)
6+
resized_image.save(output_image)
7+
print("Image resized and saved successfully.")
8+
9+
def rotate_image(input_image, output_image, degrees):
10+
image = Image.open(input_image)
11+
rotated_image = image.rotate(degrees)
12+
rotated_image.save(output_image)
13+
print("Image rotated and saved successfully.")
14+
15+
def flip_image(input_image, output_image, flip_mode):
16+
image = Image.open(input_image)
17+
flipped_image = image.transpose(flip_mode)
18+
flipped_image.save(output_image)
19+
print("Image flipped and saved successfully.")
20+
21+
# Example usage: Resize, rotate, and flip an image
22+
input_file = 'input_image.jpg'
23+
resized_file = 'resized_image.jpg'
24+
rotated_file = 'rotated_image.jpg'
25+
flipped_file = 'flipped_image.jpg'
26+
27+
new_size = (800, 600)
28+
degrees_to_rotate = 90
29+
flip_mode = Image.FLIP_LEFT_RIGHT
30+
31+
resize_image(input_file, resized_file, new_size)
32+
rotate_image(input_file, rotated_file, degrees_to_rotate)
33+
flip_image(input_file, flipped_file, flip_mode)

Readme.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# LINK SCRAPPER
2+
3+
4+
- It is used to scrape links from any website and display it.
5+
6+
7+
## Setup instructions
8+
9+
Any PC with python 3 installed can run this code.
10+
11+
12+
## Output
13+
image.png
14+
15+
## Author(s)
16+
17+
Tanya Mohanka

SCRIPTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@
9898
|94\. | Linked List | Linked List data Scripts are used to store and manage a collection of elements in a dynamic and flexible manner | [Take Me](./Linked%20List/) | [Himanshu Agarwal](https://github.com/himanshu-03)
9999
| 95\. | Searching Techniques | Searching techniques are scripts used to find a specific element or value within a collection of data. | [Take Me](./Searching%20Techniques/) | [Himanshu Agarwal](https://github.com/himanshu-03)
100100
| 96\. | Sorting Techniques | Sorting techniques are scripts that arrange a collection of data elements in a particular order, typically ascending or descending. | [Take Me](./Sorting%20Techniques/) | [Himanshu Agarwal](https://github.com/himanshu-03)
101-
| 97\. | File Downloader | A file downloader script is a program or script that automates the process of downloading files from a given URL. It enables users to retrieve files from the internet without manual intervention.. | [Take Me](./File Downloader Script/) | [Himanshu Agarwal](https://github.com/Abhinavcode13)
101+

0 commit comments

Comments
 (0)