title: Why Tkinter window opens so slowly?
body: <p>I coded a program which converts cryptocurrencies, with a basic user interface(will work on it later). My code works but for some reason the tkinter window opens so slowly. Does it have something to do with me having too much API requests on my code, or is it something else? How can I get the program running faster?</p>
  <p>Here's the code:</p>
  <pre><code>def GUIinterfaceConversion():
      # Retrieve the api data
      apiURL = &quot;https://api.nomics.com/v1/currencies/ticker?key=my_key&quot;
      rawData = requests.get(apiURL)
      data = json.loads(rawData.text)
  
      # Get the Currency Abbreviations &amp; Full Names
      currencyOutputs = []
      for element in data:
          currencyOutput = {&quot;Name&quot;:element[&quot;name&quot;],&quot;Abbreviation&quot;:element[&quot;currency&quot;]}
          currencyOutputs.append(currencyOutput)
  
      # Window Layout
      window = tk.Tk()
      window.title(&quot;Cryptocurrency Converter&quot;)
      window.geometry(&quot;1300x1000&quot;)
  
      # Listbox Layout
      Lb1 = tk.Listbox(window, width=40, height=20)
      Lb2 = tk.Listbox(window, width=40, height=20)
      for output in currencyOutputs:
          Lb1.insert(0, output[&quot;Name&quot;] + &quot;(&quot; + output[&quot;Abbreviation&quot;] + &quot;)&quot;)
          Lb2.insert(0, output[&quot;Name&quot;] + &quot;(&quot; + output[&quot;Abbreviation&quot;] + &quot;)&quot;)
  
      Lb1.place(relx=0.3, rely=0.3, anchor=&quot;center&quot;)
      Lb2.place(relx=0.7, rely=0.3, anchor=&quot;center&quot;)
  
      # On Selection
      Label1 = tk.Label(window, text=&quot;&quot;)
      Label1.place(relx=0.3,rely=0.55,anchor=&quot;center&quot;)
      Label2 = tk.Label(window, text=&quot;&quot;)
      Label2.place(relx=0.7,rely=0.55,anchor=&quot;center&quot;)
      def labelChange(event, label, listbox):
          label['text'] = &quot;Converting From: &quot; + listbox.get(listbox.curselection())
      
      Lb1.bind('&lt;&lt;ListboxSelect&gt;&gt;', lambda _: labelChange(event=any,label=Label1,listbox=Lb1))
      Lb2.bind('&lt;&lt;ListboxSelect&gt;&gt;', lambda _: labelChange(event=any,label=Label2,listbox=Lb2))
  
      # Conversion Label
      LabelConverted = tk.Label(window)
      LabelConverted.place(relx=0.5,rely=0.65,anchor=&quot;center&quot;)
  
      # Conversion Button
      def convert():
          firstElement = Label1['text'].split(': ')[1].split(&quot;(&quot;)[1].split(&quot;)&quot;)[0]
          secondElement = Label2['text'].split(': ')[1].split(&quot;(&quot;)[1].split(&quot;)&quot;)[0]
  
          # Get API
          convertingApi = f&quot;https://api.nomics.com/v1/currencies/ticker?key=my_key={firstElement}&quot;
          convertedApi = f&quot;https://api.nomics.com/v1/currencies/ticker?key=my_key&amp;ids={secondElement}&quot;
          converting = json.loads(requests.get(convertingApi).text)
          converted = json.loads(requests.get(convertedApi).text)
  
          # Generate the ratio and the final amount
          twoCurrenciesRatio = float(converting[0]['price'])/float(converted[0]['price'])
          finalAmount = format(twoCurrenciesRatio,'.8f')
          LabelConverted['text'] = finalAmount
  
      B = tk.Button(window, text=&quot;Convert&quot;, command=convert)
      B.place(relx=0.5,rely=0.55,anchor=&quot;center&quot;)
  
      window.mainloop()
  
  GUIinterfaceConversion()
  </code></pre>
  <p>Thanks a lot in advance :)</p>