Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Creating a User-Friendly Link Selector in Taipy: How to Display a List of Links in a Selector

I want to create a little Taipy application where I would be able to choose an image from a selector, table, or toggle.

I have a list of image links that I need to display where users can choose one of the options. Is there a way to use a list with image links and texts and display it in a user-friendly interface (UI)?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can use Icon in Taipy for this use if you like. An example is in the doc here. It is then possible to display a list of images (Icon) with some text.

The code below is a little example of applying this for image links. Note that it can also work by providing the path to a local image.

from taipy.gui import Gui, Icon

img_1 = "https://s18670.pcdn.co/wp-content/uploads/GettyImages-1135297525.jpg"
img_2 = "https://3.bp.blogspot.com/_kSiL_6q6sXI/TSjKjZRi_nI/AAAAAAAAAg0/DAWJ7Omn1c8/s640/2011_tropical_rainforest_animals_pictures_jaguar.jpg"
img_3 = "https://3.bp.blogspot.com/-qYR8Mv0vdjA/UBAAwoaggQI/AAAAAAAAANs/p6bddoHCVI0/s1600/Ocean-life-wallpapers-marine-life-on-the-seabed-like-fish-plants-animals-hd-wallpaper-02.jpg"


list_img = [(img_1, Icon(img_1, "Image 1")),
            (img_2, Icon(img_2, "Image 2")),
            (img_3, Icon(img_3, "Image 3"))]

selected_image = list_img[0]

md = """
<|{selected_image}|selector|lov={list_img}|>

<|{selected_image[0]}|image|>
"""

Gui(md).run()

Results of code

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading