bchao1 / bullet

🚅 Interactive prompts made simple. Build a prompt like stacking blocks.
https://pypi.org/project/bullet/
MIT License
3.55k stars 113 forks source link

[Query] Callbacks and Validators #65

Open e0lithic opened 4 years ago

e0lithic commented 4 years ago

Hi,

My usecase is that I would like to generate the choices for the next question in the SlidePrompt based on the inputs the user provided to the previous question. I went through the documentation but did not find relevant information on it.

So to summarize :

  1. Ability to have callbacks which get triggered so that that the state of variables in the program can be changed or functions could be fired in order to facilitate the next set of choices.
  2. Can we also have generic user defined validators just like the Number prompt which is number specific.

Please let me know if I have missed something.

Keep up the great work. Thanks.

e0lithic commented 4 years ago

I was able to implement the custom usecase using the basic ui components and wrapping up in a class.However, keeping this issue open for discussion on callbacks as they would greatly help in making a reusable API.