GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — App-Development-with-Python-using-GUI-Tools/30.Weather.py at main · sarincr/App-Development-with-Python-using-GUI-Tools Expand file tree/ Copy path30.Weather.pyMore file actions 44 lines (29 loc) · 1.05 KB / Copy path30.Weather.pyFile metadata and controls44 lines (29 loc) · 1.05 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 from tkinter import * import requests import json tk = Tk() tk.title('Find Weather') tk.geometry("550x300") def WethData(): city = city_entry.get() state = state_entry.get() api_request = requests.get(f"https://api.hgbrasil.com/weather?key=d08c55d1&city_name={city},{state};locale=en") api = json.loads(api_request.content) max = api['results']['forecast'][0]['max'] min = api['results']['forecast'][0]['min'] description = api['results']['description'] WLab = Label(tk, text=f'Max temperature {max}°C Min temperature {min}°C {description}') WLab.grid(row=3, column=0) lb = Label(tk, text='Check your location') lb.grid(row=0, column=0) pllab = Label(tk, text="Enter Place") pllab.grid(row=1, column=0) stlab= Label(tk, text='Enter State') stlab.grid(row=2, column=0) city_entry = Entry(tk, width=25, borderwidth=5) city_entry.grid(row=1, column=1) state_entry = Entry(tk, width=25, borderwidth=5) state_entry.grid(row=2, column=1) btn = Button(tk, text='search', command=WethData) btn.grid(row=3, column=1) tk.mainloop() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |