+ 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 [Offline 🙃]
Sakshi [Offline 🙃] - avatar
20 odpowiedzi
+ 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 [Offline 🙃]
Sakshi [Offline 🙃] - 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 [Offline 🙃]
Sakshi [Offline 🙃] - 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 [Offline 🙃]
Sakshi [Offline 🙃] - 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 [Offline 🙃]
Sakshi [Offline 🙃] - avatar
+ 2
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 [Offline 🙃]
Sakshi [Offline 🙃] - 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 [Offline 🙃]
Sakshi [Offline 🙃] - avatar
23rd May 2023, 5:50 AM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - 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 [Offline 🙃]
Sakshi [Offline 🙃] - 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 [Offline 🙃]
Sakshi [Offline 🙃] - avatar