PyInquirer icon indicating copy to clipboard operation
PyInquirer copied to clipboard

Update message based on current choices in checkbox

Open atrifex opened this issue 6 years ago • 2 comments

In the Pizza example, it makes sense to update the message with something like the cost.

The questions array basically needs message_update function similar to the validate function and this will just update the message based on that.

atrifex avatar Feb 27 '19 06:02 atrifex

The documentation says that the "message" attribute of a question can be a string or a function that takes the current answers and returns a string. I guess you could use this to solve your issue, however, that doesn't appear to be accurate documentation as any function, or lambda, I use as a questions "message" gets evaluated as a string in the prompt.

AndrewOwenMartin avatar Apr 26 '19 10:04 AndrewOwenMartin

The documentation says that the "message" attribute of a question can be a string or a function that takes the current answers and returns a string. I guess you could use this to solve your issue, however, that doesn't appear to be accurate documentation as any function, or lambda, I use as a questions "message" gets evaluated as a string in the prompt.

I see now that I was taking about something else, I was talking about changing the message due to previous answers, this issue is about updating the message for checkboxes as the selection changes.

AndrewOwenMartin avatar Apr 26 '19 13:04 AndrewOwenMartin