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.
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.
Open to other suggestions.