title: Update tqdm bar
body: <p>I'm creating a small script for me to download youtube videos sounds.
  Everytime you download a sound i use a tqdm bar to display download infos.</p>
  <p>The first time you download everything work fine, but the second time my bar is completely destroyed :(. i really don't know what's happening with it...</p>
  <p>(i think the bar doesn't update correctly)</p>
  <p>Here's the code that handle the bar and download the sound</p>
  <p>Thanks for your time :)</p>
  <pre><code>def DownloadAudioFromUrl(url):
      print(&quot;Getting the URL...&quot;)
      vid = pafy.new(url)
      print(&quot;Done&quot;)
  
      print(&quot;Getting best quality...&quot;)
      stream = vid.getbestaudio()
      fileSize = stream.get_filesize()
      print(&quot;Done&quot;)
  
      print(&quot;Downloading: &quot; + vid.title + &quot; ...&quot;)
      with tqdm.tqdm(total=fileSize, unit_scale=True, unit='B', initial=0) as pbar:
          stream.download(&quot;Download/&quot;, quiet=True, callback=lambda _, received, *args: UpdateBar(pbar, received))
      print(&quot;Done&quot;)
  
      ResetProgressBar(pbar)
  
      WebmToMp3()
  
  def ResetProgressBar(bar):
      bar.reset()
      bar.clear()
      bar.close()
      # i used these last time i tried i don't undersand how they work :/
  
  def UpdateBar(pbar, current_received):
      global previous_received
  
      diff = current_received - previous_received
      pbar.update(diff)
      previous_received = current_received
  </code></pre>
  <p>So i tried to update the bar with &quot;reset&quot; &quot;clear&quot; and &quot;stop&quot; but it changed nothing</p>