Download_image function

This commit is contained in:
markrz12 2023-12-19 16:13:56 +01:00
parent e1d147f6dc
commit 8e319bc4bb
2 changed files with 6 additions and 3 deletions

View File

@ -33,7 +33,7 @@ def settings() -> rx.Component:
rx.button("Anonimizuj",
width = "125px"),
rx.button("Pobierz",
#on_click=lambda img_name=img: State.download_image(img_name),
on_click=lambda img_name=img: State.download_image(img_name),
width = "125px"),
padding="1em"
),

View File

@ -32,8 +32,11 @@ class State(rx.State):
if img_name in self.img:
self.img.remove(img_name)
self.img=self.img
def download_image(img_name: str):
return rx.download(url=f'/{img_name}', filename=img_name)
def download_image(self, img_name):
print(self.img)
return rx.download(url=f'/{img_name}', filename=img_name)