Images not display #3888
-
QuestionImages not displayed when using local path and setting AppView to "WEB_BROWSER" Code sampleimport flet as ft
def main(page: ft.Page):
page.title = "GridView Example"
page.theme_mode = ft.ThemeMode.DARK
page.padding = 50
page.update()
images = ft.GridView(
expand=1,
runs_count=5,
max_extent=200,
child_aspect_ratio=1.0,
spacing=50,
run_spacing=50,
)
page.add(images)
for img in ['img1.jpg', 'img2.jpg', 'img3.jpg', 'img4.jpg']:
images.controls.append(
ft.Image(
src=f"./img/{img}",
fit=ft.ImageFit.CONTAIN,
repeat=ft.ImageRepeat.NO_REPEAT,
border_radius=ft.border_radius.all(10),
tooltip='Compressor',
)
)
page.update()
ft.app(target=main, view=ft.WEB_BROWSER) Error messageBlank browser page ------------------------------------------------------
|
Beta Was this translation helpful? Give feedback.
Answered by
ndonkoHenri
Aug 30, 2024
Replies: 3 comments 4 replies
-
Remove the first dot from the path and retry. |
Beta Was this translation helpful? Give feedback.
2 replies
-
It works well now. Thanks a lot for your guideline! 👍 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read this: https://flet.dev/docs/controls/image#src
You need to set the img folder as asset directory.