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

Add examples on broadcasting variables to subset of states #941

Open
maxHeez opened this issue May 3, 2024 · 7 comments
Open

Add examples on broadcasting variables to subset of states #941

maxHeez opened this issue May 3, 2024 · 7 comments
Labels
📄 Documentation Internal or public documentation 🖰 GUI Related to GUI 📈 Improvement Improvement of a feature. 🟧 Priority: High Stalls work on the project or its dependents

Comments

@maxHeez
Copy link

maxHeez commented May 3, 2024

Description
I could not find other documentation than that to broadcast variable values.

I am managing a location variable pointing to a country or region in the world. In my application I have another variable named information. I want all the other states sharing the same location value as mine to share the same information value as well.
How to broadcast a variable value to a subset of states?

def state_filter(source_state, other_state):
    if other_state["location"] == source_state["location"]:
        return True
    return False

broadcast("information", value, state_filter)
@maxHeez maxHeez added the 📈 Improvement Improvement of a feature. label May 3, 2024
@FlorianJacta FlorianJacta added 🖰 GUI Related to GUI 📄 Documentation Internal or public documentation 🟨 Priority: Medium Not blocking but should be fixed soon labels May 6, 2024
@FlorianJacta
Copy link
Member

FlorianJacta commented May 6, 2024

Thank you for the issue; this could greatly improve the documentation. I think it is not exposed yet

@FredLL-Avaiga
Copy link
Member

FredLL-Avaiga commented May 10, 2024

As far as I know, this is not supported yet 🥲

cf. taipy #1207

@FlorianJacta FlorianJacta added the ❌ Blocked Issue is blocked label May 13, 2024
@FlorianJacta
Copy link
Member

I am putting this as blocked by Avaiga/taipy#1207

@maxHeez
Copy link
Author

maxHeez commented May 13, 2024

Ok. Is this something scheduled for the next Taipy version? Or do you have a workaround?

@FlorianJacta
Copy link
Member

There are no workaround available now. What you could do is to have the filter after broadcasting it to all the users

@maxHeez
Copy link
Author

maxHeez commented Sep 13, 2024

I can see some PRs are closed on this topic.
Any update? Any documentation to help on this?

@FlorianJacta
Copy link
Member

FlorianJacta commented Sep 13, 2024

This has been done in develop. There needs to be more documentation.
This works by broadcasting a callback to every client; inside this callback, the developer decides what to do.

https://docs.taipy.io/en/develop/refmans/reference/taipy.gui.Gui/#taipy.gui.Gui.broadcast_callback

def a_callback(state):
    gui= state.get_gui()
    gui.broadcast_callback(your_callback_sent_to_everyone, [state.location])



def your_callback_sent_to_everyone(state, args):
    source_location = args[0]
    if source_location == state.location:
        ... # do what you want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📄 Documentation Internal or public documentation 🖰 GUI Related to GUI 📈 Improvement Improvement of a feature. 🟧 Priority: High Stalls work on the project or its dependents
Projects
None yet
Development

No branches or pull requests

4 participants