Skip to content

Eventhanders calling other other eventhandlers with args #876

Description

@Alek99

Event handlers should be able to call other event handlers with arguments. I think the best way would be todo this with a lambda similar to how its done in our ui elements.

class State(pc.State):
    """The app state."""
    self.option: str = "DFS"

    def bfs(self, arg1, arg2):
       ...

    def dfs(self, arg1, arg2):
       ...

    def run(self):
            """Run the selected algorithm.""
            if self.option == "DFS":
                return lambda _: self.dfs(arg1, arg2)
            elif self.option == "BFS":
                return   lambda _: self.bfs(arg1, arg2)

Open to other suggestions.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions