Please I need to know how to download images and then present them in a tkinter Label. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Please I need to know how to download images and then present them in a tkinter Label.

Por favor, necesito saber cómo descargar imágenes para luego presentarlas en una etiqueta de tkinter.

26th Jan 2022, 5:24 PM
CGO!
CGO! - avatar
7 Answers
+ 1
https://code.sololearn.com/cm9RRK2WAYts/?ref=app creo que esto te debe funcionar. btw en stackoverflow.com puedes encontrar respuesta a la mayoria de preguntas q tengas
28th Jan 2022, 8:27 PM
Bakteria
Bakteria - avatar
+ 2
The first thing you have to do is to download the image. Then you have to save the binary data you downloaded (the image) in a file. The last thing is to display the image on a tkinter window using widget Label with the image. NOTE: You're image has the be in some of the following formats (gif, png). If the image is in another format tjen tkinter won't recognize the image and wont display it. To display images in tkinter with other formats you can use pillow library.
27th Jan 2022, 4:56 AM
Hacker-KR4636
Hacker-KR4636 - avatar
+ 2
But how can I download the photos with Python and then print him with Label? Hacker-KR4636 Lobo Solitario
27th Jan 2022, 11:38 AM
CGO!
CGO! - avatar
+ 1
Primero descarga la imagen y colocas la ruta la sintaxis es ventana = Tk() imagen = PhotoImage(file="nombre.png") guardar_imagen = Label(ventana,image=imagen) guardar_imagen.pack() ventana.mainloop()
27th Jan 2022, 4:29 AM
FisMatHack
FisMatHack - avatar
+ 1
To download an image you can use sockets, urllib, request, (Standard libraries), etc
28th Jan 2022, 4:08 PM
Hacker-KR4636
Hacker-KR4636 - avatar
+ 1
But how? Hacker-KR4636 Show me please
28th Jan 2022, 6:20 PM
CGO!
CGO! - avatar
+ 1
Gracias, Bakteria
28th Jan 2022, 9:16 PM
CGO!
CGO! - avatar