Thursday, August 4, 2022

Lesson 19_continued

 What's troubling me with all this is how the progressbar connects with the download.

Been replicating this code from Pythonista. Very interesting; got to use the python 'requests'

library, one of the most popular:

                                                                        


                                                           


                                                                               



https://youtu.be/Xhw2l-hzoKk


Revisiting this code; this time asking for the size of the file. I have disengaged the 'ignore

warnings' provision, and a problem with the code does emerge.

                                                                         


One might assume - and it is true - that all files are multiples of 1024 bits. 

 The program here encounters a rounding difficulty. A byte might contain 8 bits; 

but 9 bytes divided by 8 is not an integer. 👧


                                                             *     *     *

Below, the code from Code Bro. I've altered things to a sleep time of half

a second (rather than 0.05) and made the values increment by 5 (rather than

leavins speed at 1). One can see what's happening.


Crucial to the deroulement is the window.update_idletasks() function.

We would only see the completed download otherwise...


                                                                


                                                                         


                                                                              


No comments: