Set the height & width, text b/w the two images | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 5

Set the height & width, text b/w the two images

I want to set the height & width of that image and I want to also write the text between the two images, I already google it but the nothing it shows through urllib module.

23rd May 2023, 3:41 AM
Sakshi
Sakshi - avatar
20 Respostas
+ 3
Ok so use os module and import the images as usual https://code.sololearn.com/c9hQ1gXIZ9oU/?ref=app
23rd May 2023, 5:32 AM
Ugulberto SƔnchez
Ugulberto SƔnchez - avatar
+ 2
Ugulberto SƔnchez doesn't matter the height and width should be fixed but at least I want to show the text b/w the two images, that's the main problem
23rd May 2023, 5:38 AM
Sakshi
Sakshi - avatar
+ 2
Sakshi (less active) Did you quit display: none From img css rule?
23rd May 2023, 5:45 AM
Ugulberto SƔnchez
Ugulberto SƔnchez - avatar
+ 2
Oh, I donā€™t know what is not working. Wait a moment
23rd May 2023, 5:47 AM
Ugulberto SƔnchez
Ugulberto SƔnchez - avatar
+ 2
Ok show your code
23rd May 2023, 5:47 AM
Ugulberto SƔnchez
Ugulberto SƔnchez - avatar
+ 2
Ugulberto SĆ”nchez I also tried in another way also, btw leave it that problem is not solved & thank you bro for help šŸ˜Š
23rd May 2023, 6:03 AM
Sakshi
Sakshi - avatar
+ 2
xd there arenā€™t images displayed in the screen, you have to put an img tag like in html to display that
23rd May 2023, 6:31 AM
Ugulberto SƔnchez
Ugulberto SƔnchez - avatar
+ 2
Ugulberto SƔnchez I also tried in image tag bro
23rd May 2023, 6:50 AM
Sakshi
Sakshi - avatar
+ 2
Sakshi (less active) oh! So I donā€™t know what to do, Iā€™m not experienced with python html :((
23rd May 2023, 6:50 AM
Ugulberto SƔnchez
Ugulberto SƔnchez - avatar
+ 2
Ugulberto SƔnchez no problem bro, I tried also different module like Pillow module but the problem is same, main problem is the text is show above the image not showing in b/w.
23rd May 2023, 6:54 AM
Sakshi
Sakshi - avatar
23rd May 2023, 8:16 AM
Ugulberto SƔnchez
Ugulberto SƔnchez - avatar
+ 2
Hey Sakshi sis can I see your code šŸ˜Ž I wanna try, I think I can do it
24th May 2023, 5:06 AM
Vaibhav
Vaibhav - avatar
+ 2
If you want to set the height and width of an image using the urllib module in Python, you can first download the image using urllib and then use an HTML template to display the image with the desired dimensions and text. import urllib.request image_url = 'https://example.com/image.jpg' urllib.request.urlretrieve(image_url, 'image.jpg') # Set the desired height and width image_height = 200 image_width = 300 html_code = f''' <!DOCTYPE html> <html> <head> <style> .container {{ display: flex; justify-content: center; align-items: center; }} .image {{ height: {image_height}px; width: {image_width}px; }} .text {{ margin: 0 20px; font-size: 20px; }} </style> </head> <body> <div class="container"> <img class="image" src="image.jpg" alt="Image"> <span class="text">Your Text Goes Here</span> <img class="image" src="image.jpg" alt="Image"> </div> </body> </html> ''' with open('output.html', 'w') as f: f.write(html_code)
24th May 2023, 5:20 AM
Vaibhav
Vaibhav - avatar
+ 1
Ugulberto SƔnchez bro I tried the html also but the image is not showing
23rd May 2023, 5:34 AM
Sakshi
Sakshi - avatar
+ 1
Ugulberto SƔnchez I use img and then put the image in src attribute instead of display: none, but the image is not showing
23rd May 2023, 5:46 AM
Sakshi
Sakshi - avatar
+ 1
Mirielle Oh ok , Thank you so much mam for telling me, otherwise I am tired to try it again and again šŸ˜…
23rd May 2023, 11:37 AM
Sakshi
Sakshi - avatar
0
if 3 of the people will be the boolean of the comma so the function of the unicode is that the license will be C. that what happened in JS
23rd May 2023, 2:43 PM
Bellal Haq
0
i am learning the intro of python and HTML these type of qs confuse me yaar šŸ˜©šŸ˜©šŸ˜©
24th May 2023, 2:07 AM
Syed Ikhlas
Syed Ikhlas - avatar
0
ANIMESH DINDA don't advertise the code here
24th May 2023, 6:23 AM
Sakshi
Sakshi - avatar