Skip to content
Open
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
13 changes: 11 additions & 2 deletions WeatherApp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import tkinter as tk
import requests

import pyttsx3
engine= pyttsx3.init()
voices= engine.getProperty('voices')
engine.setProperty('voice',voices[1].id)
def say(word):
engine.say(word)
engine.runAndWait()

HEIGHT = 500
WIDTH = 600

Expand Down Expand Up @@ -30,6 +37,7 @@ def get_weather(city):
weather = response.json()

label['text'] = format_response(weather)
say(label['text'])



Expand All @@ -47,6 +55,7 @@ def get_weather(city):

entry = tk.Entry(frame, font=40)
entry.place(relwidth=0.65, relheight=1)
entry.focus()

button = tk.Button(frame, text="Get Weather", font=40, command=lambda: get_weather(entry.get()))
button.place(relx=0.7, relheight=1, relwidth=0.3)
Expand All @@ -57,4 +66,4 @@ def get_weather(city):
label = tk.Label(lower_frame)
label.place(relwidth=1, relheight=1)

root.mainloop()
root.mainloop()
11 changes: 10 additions & 1 deletion WeatherApp_withicons.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import tkinter as tk
import requests
from PIL import Image, ImageTk
import pyttsx3
engine= pyttsx3.init()
voices= engine.getProperty('voices')
engine.setProperty('voice',voices[1].id)

def say(word):
engine.say(word)
engine.runAndWait()

app = tk.Tk()

Expand Down Expand Up @@ -52,6 +60,7 @@ def open_image(icon):

textbox = tk.Entry(frame, font=40)
textbox.place(relwidth=0.65, relheight=1)
textbox.focus()

submit = tk.Button(frame, text='Get Weather', font=40, command=lambda: get_weather(textbox.get()))
#submit.config(font=)
Expand All @@ -73,4 +82,4 @@ def open_image(icon):



app.mainloop()
app.mainloop()