How to download and display an image from the web #1167
JERisBRISK
started this conversation in
Showcase
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I recently figured out how to download and display an image in DearPyGui for an NFT collection browser I'm coding up. I posted this image in the DPG Discord and someone asked me how I did it.
Some discussion ensued, and I was asked to post my answers here. First, I used the following articles as inspiration:
https://github.com/hoffstadt/DearPyGui/wiki/Drawing-API
https://stackoverflow.com/questions/13137817/how-to-download-image-using-requests
Then, I wrote the following routine:
Later in my code, I optionally download and add the image thumbnail to my table via this bit:
The code could do a bit more to avoid redundant I/O (like checking if the
thumbnail
static texture exists instead of checking for the file being present on disk), but this pretty much is the gist of it.Beta Was this translation helpful? Give feedback.
All reactions