├── README.md ├── .gitattributes ├── Video2GIF └── gif.py ├── Video2AudioConverter └── converter.py ├── Cartoonize └── cartoon.py ├── News_App └── newsapp.py ├── CoronaTrackerAPI └── corona.py ├── Notepad └── notepad.py ├── WeatherApp └── weather.py └── Amongus_Character └── among.py /README.md: -------------------------------------------------------------------------------- 1 | # Python_Scripts 2 | 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /Video2GIF/gif.py: -------------------------------------------------------------------------------- 1 | from moviepy.editor import VideoFileClip 2 | from tkinter.filedialog import * 3 | 4 | video = askopenfilename() 5 | clip = VideoFileClip(video) 6 | clip.write_gif("mygif.gif", fps=10) -------------------------------------------------------------------------------- /Video2AudioConverter/converter.py: -------------------------------------------------------------------------------- 1 | import moviepy.editor 2 | from tkinter.filedialog import * 3 | 4 | video = askopenfilename() 5 | video = moviepy.editor.VideoFileClip(video) 6 | audio = video.audio 7 | 8 | audio.write_audiofile("sample.mp3") 9 | print("Completed!") -------------------------------------------------------------------------------- /Cartoonize/cartoon.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | from tkinter.filedialog import * 4 | 5 | photo = askopenfilename() 6 | img = cv2.imread(photo) 7 | 8 | grey = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 9 | grey = cv2.medianBlur(grey, 5) 10 | edges = cv2.adaptiveThreshold(grey, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, 9, 9) 11 | 12 | #cartoonize 13 | color = cv2.bilateralFilter(img, 9, 250, 250) 14 | cartoon = cv2.bitwise_and(color, color, mask = edges) 15 | 16 | cv2.imshow("Image", img) 17 | cv2.imshow("Cartoon", cartoon) 18 | 19 | #save 20 | cv2.imwrite("cartoon.jpg", cartoon) 21 | cv2.waitKey(0) 22 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /News_App/newsapp.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import tkinter as tk 3 | 4 | 5 | def getNews(): 6 | api_key = "69098ca7575f42069325e5168a565e07" 7 | url = "https://newsapi.org/v2/top-headlines?country=us&apiKey="+api_key 8 | news = requests.get(url).json() 9 | 10 | articles = news["articles"] 11 | 12 | my_articles = [] 13 | my_news = "" 14 | 15 | for article in articles: 16 | my_articles.append(article["title"]) 17 | 18 | for i in range(10): 19 | my_news = my_news + str(i+1) + ". " + my_articles[i] + "\n" 20 | 21 | label.config(text = my_news) 22 | 23 | 24 | 25 | canvas = tk.Tk() 26 | canvas.geometry("900x600") 27 | canvas.title("News App") 28 | 29 | button = tk.Button(canvas, font = 24, text = "Reload", command = getNews) 30 | button.pack(pady = 20) 31 | 32 | label = tk.Label(canvas, font = 18, justify = "left") 33 | label.pack(pady = 20) 34 | 35 | getNews() 36 | 37 | canvas.mainloop() -------------------------------------------------------------------------------- /CoronaTrackerAPI/corona.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | import requests 3 | import datetime 4 | 5 | def getCovidData(): 6 | api = "https://disease.sh/v3/covid-19/all" 7 | json_data = requests.get(api).json() 8 | total_cases = str(json_data['cases']) 9 | total_deaths = str(json_data['deaths']) 10 | today_cases = str(json_data['todayCases']) 11 | today_deaths = str(json_data['todayDeaths']) 12 | today_recovered = str(json_data['todayRecovered']) 13 | updated_at = json_data['updated'] 14 | date = datetime.datetime.fromtimestamp(updated_at/1e3) 15 | label.config(text = "Total Cases: "+total_cases+ 16 | "\n"+"Total Deaths: "+total_deaths+ 17 | "\n"+"Today Cases: "+today_cases+ 18 | "\n"+"Today Deaths: "+today_deaths+ 19 | "\n"+"Today Recovered: "+today_recovered) 20 | 21 | label2.config(text = date) 22 | canvas = tk.Tk() 23 | canvas.geometry("400x400") 24 | canvas.title("Corona Tracker App") 25 | 26 | f = ("poppins", 15, "bold") 27 | 28 | button = tk.Button(canvas, font = f, text = "Load", command = getCovidData) 29 | button.pack(pady = 20) 30 | 31 | label = tk.Label(canvas, font = f) 32 | label.pack(pady=20) 33 | 34 | label2 = tk.Label(canvas, font = 8) 35 | label2.pack() 36 | getCovidData() 37 | 38 | canvas.mainloop() -------------------------------------------------------------------------------- /Notepad/notepad.py: -------------------------------------------------------------------------------- 1 | from tkinter.filedialog import * 2 | import tkinter as tk 3 | 4 | def saveFile(): 5 | new_file = asksaveasfile(mode = 'w', filetype = [('text files', '.txt')]) 6 | if new_file is None: 7 | return 8 | text = str(entry.get(1.0, END)) 9 | new_file.write(text) 10 | new_file.close() 11 | 12 | def openFile(): 13 | file = askopenfile(mode = 'r', filetype = [('text files', '*.txt')]) 14 | if file is not None: 15 | content = file.read() 16 | entry.insert(INSERT, content) 17 | 18 | def clearFile(): 19 | entry.delete(1.0, END) 20 | 21 | canvas = tk.Tk() 22 | canvas.geometry("400x600") 23 | canvas.title("Notepad") 24 | canvas.config(bg = "white") 25 | top = Frame(canvas) 26 | top.pack(padx = 10, pady = 5, anchor = 'nw') 27 | 28 | b1 = Button(canvas, text="Open", bg = "white", command = openFile) 29 | b1.pack(in_ = top, side=LEFT) 30 | 31 | b2 = Button(canvas, text="Save", bg = "white", command = saveFile) 32 | b2.pack(in_ = top, side=LEFT) 33 | 34 | b3 = Button(canvas, text="Clear", bg = "white", command = clearFile) 35 | b3.pack(in_ = top, side=LEFT) 36 | 37 | b4 = Button(canvas, text="Exit", bg = "white", command = exit) 38 | b4.pack(in_ = top, side=LEFT) 39 | 40 | entry = Text(canvas, wrap = WORD, bg = "#F9DDA4", font = ("poppins", 15)) 41 | entry.pack(padx = 10, pady = 5, expand = TRUE, fill = BOTH) 42 | 43 | canvas.mainloop() -------------------------------------------------------------------------------- /WeatherApp/weather.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | import requests 3 | import time 4 | 5 | 6 | def getWeather(canvas): 7 | city = textField.get() 8 | api = "https://api.openweathermap.org/data/2.5/weather?q="+city+"&appid=06c921750b9a82d8f5d1294e1586276f" 9 | 10 | json_data = requests.get(api).json() 11 | condition = json_data['weather'][0]['main'] 12 | temp = int(json_data['main']['temp'] - 273.15) 13 | min_temp = int(json_data['main']['temp_min'] - 273.15) 14 | max_temp = int(json_data['main']['temp_max'] - 273.15) 15 | pressure = json_data['main']['pressure'] 16 | humidity = json_data['main']['humidity'] 17 | wind = json_data['wind']['speed'] 18 | sunrise = time.strftime('%I:%M:%S', time.gmtime(json_data['sys']['sunrise'] - 21600)) 19 | sunset = time.strftime('%I:%M:%S', time.gmtime(json_data['sys']['sunset'] - 21600)) 20 | 21 | final_info = condition + "\n" + str(temp) + "°C" 22 | final_data = "\n"+ "Min Temp: " + str(min_temp) + "°C" + "\n" + "Max Temp: " + str(max_temp) + "°C" +"\n" + "Pressure: " + str(pressure) + "\n" +"Humidity: " + str(humidity) + "\n" +"Wind Speed: " + str(wind) + "\n" + "Sunrise: " + sunrise + "\n" + "Sunset: " + sunset 23 | label1.config(text = final_info) 24 | label2.config(text = final_data) 25 | 26 | 27 | canvas = tk.Tk() 28 | canvas.geometry("600x500") 29 | canvas.title("Weather App") 30 | f = ("poppins", 15, "bold") 31 | t = ("poppins", 35, "bold") 32 | 33 | textField = tk.Entry(canvas, justify='center', width = 20, font = t) 34 | textField.pack(pady = 20) 35 | textField.focus() 36 | textField.bind('', getWeather) 37 | 38 | label1 = tk.Label(canvas, font=t) 39 | label1.pack() 40 | label2 = tk.Label(canvas, font=f) 41 | label2.pack() 42 | canvas.mainloop() -------------------------------------------------------------------------------- /Amongus_Character/among.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | body_color = 'cyan' 4 | glass_color = '#9acedc' 5 | 6 | s = turtle.getscreen() 7 | t = turtle.Turtle() 8 | 9 | def body(): 10 | t.pensize(20) 11 | t.fillcolor(body_color) 12 | t.begin_fill() 13 | t.right(90) 14 | t.forward(50) 15 | t.right(180) 16 | t.circle(40, -180) 17 | t.right(180) 18 | t.forward(200) 19 | 20 | t.right(180) 21 | t.circle(100, -180) 22 | 23 | t.backward(20) 24 | t.left(15) 25 | t.circle(500, -20) 26 | t.backward(20) 27 | 28 | t.circle(40, -180) 29 | t.left(7) 30 | t.backward(50) 31 | 32 | t.up() 33 | t.left(90) 34 | t.forward(10) 35 | t.right(90) 36 | t.down() 37 | 38 | t.right(240) 39 | t.circle(50, -70) 40 | 41 | t.end_fill() 42 | 43 | def glass(): 44 | t.up() 45 | t.right(230) 46 | t.forward(100) 47 | t.left(90) 48 | t.forward(20) 49 | t.right(90) 50 | 51 | t.down() 52 | t.fillcolor(glass_color) 53 | t.begin_fill() 54 | 55 | t.right(150) 56 | t.circle(90, -55) 57 | 58 | t.right(180) 59 | t.forward(1) 60 | t.right(180) 61 | t.circle(10, -65) 62 | t.right(180) 63 | t.forward(110) 64 | t.right(180) 65 | 66 | t.circle(50, -190) 67 | t.right(170) 68 | t.forward(80) 69 | 70 | t.right(180) 71 | t.circle(45, -30) 72 | 73 | t.end_fill() 74 | 75 | def backpack(): 76 | t.up() 77 | t.right(60) 78 | t.forward(100) 79 | t.right(90) 80 | t.forward(75) 81 | 82 | t.fillcolor(body_color) 83 | t.begin_fill() 84 | 85 | t.down() 86 | t.forward(30) 87 | t.right(255) 88 | 89 | t.circle(300, -30) 90 | t.right(260) 91 | t.forward(30) 92 | 93 | t.end_fill() 94 | 95 | body() 96 | glass() 97 | backpack() 98 | 99 | t.screen.exitonclick() 100 | --------------------------------------------------------------------------------