Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Its state persist even after several reruns. #41

Open
Girrajjangid opened this issue Dec 18, 2024 · 0 comments
Open

Its state persist even after several reruns. #41

Girrajjangid opened this issue Dec 18, 2024 · 0 comments

Comments

@Girrajjangid
Copy link

This is code. Which is running in loop. I am not able to track user clicking on which card. Like after clicking 1-2 cards. there clicked states should not be True it should False but it is working in that way.

        with open(f"icons/{status}_{image_name}", "rb") as f:
            data = "data:image/png;base64," + base64.b64encode(f.read()).decode("utf-8")
        
        styles = {"card": {
                        "width": "100px",
                        "height": "100px",
                        "border-radius": "10px",
                        "margin": "0",
                        "padding": "0",
                        "box-shadow": "0 0 5px rgba(0,0,0,0.5)"
                    },
                    "filter": {
                        "background-color": "rgba(0, 0, 0, 0)"
                    }
                }
        
        has_clicked = card(title="", text="", image=data, styles=styles , key=card_id, 
                           on_click=lambda : onClickListener.card_click(card_id))
        
        if has_clicked:
            print("Clicked id: ", card_id, str(datetime.datetime.now()))
            st.session_state.selected_marker = card_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant