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", rx.button("Anonimizuj",
width = "125px"), width = "125px"),
rx.button("Pobierz", 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"), width = "125px"),
padding="1em" padding="1em"
), ),

View File

@ -32,11 +32,14 @@ class State(rx.State):
if img_name in self.img: if img_name in self.img:
self.img.remove(img_name) self.img.remove(img_name)
self.img=self.img self.img=self.img
def download_image(img_name: str): def download_image(self, img_name):
print(self.img)
return rx.download(url=f'/{img_name}', filename=img_name) return rx.download(url=f'/{img_name}', filename=img_name)
#async def toggle_dark_mode(self): #async def toggle_dark_mode(self):
# self.dark_mode = not self.dark_mode # self.dark_mode = not self.dark_mode
# print(f"Dark Mode State: {self.dark_mode}") # print(f"Dark Mode State: {self.dark_mode}")