title: I am very new to writing code and am struggling two link the code for a label in a GUI and the Code for an API
body: <p>I have coded both the GUI and the API separately, i tried a couple different ways of linking the two. but thought just posting the bare bone structure would be easiest that way only the code to link the two would need to be discussed.
  The code for the GUI is what follows</p>
  
  <pre><code>from tkinter import *
  def weather_search():
  
  
      root = Tk()
  
      root.title("Weather")
      root.geometry("800x600")
  
      app = Frame(root)
      app.grid() #This puts the frame into the grid
      label = Label(app, text = "Weather")
      label.grid()
  
      location_label = Label(root,text = "Enter a Location")
      location_entry = Entry(root)
  
      location_label.grid(row=1, column = 1) 
      location_entry.grid(row=1, column = 2) 
  </code></pre>
  
  <p>Guessing this is what i will have to link to the API. But this is also where my limited experience  is causing the problems.</p>
  
  <pre><code>    user_location = location_entry.get()
      print(user_location)
  </code></pre>
  
  <p>I tried using this but i am sure there is more that needs to be done.</p>
  
  <pre><code>    root.mainloop()
  
  weather_search()
  
  #the code for the API is what follows
  
  import requests
  
  city = input("Enter: ")
  
  url = 'http://api.openweathermap.org/data/2.5/weather?q={}&amp;appid=46346a863b94cd3b89bad166fed78b7d&amp;units=metric'.format(city)
  
  res = requests.get(url)
  data = res.json()
  
  print(res)
  print(data)
  </code></pre>
  
  <p>I am not sure if i would need a search function for once the location is entered.</p>