Skip to content

Commit bd0d8d6

Browse files
committed
add filter_list callback example
1 parent e35c32c commit bd0d8d6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

examples/filter_list.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,19 @@ def filter_func(text, collection):
3434
return list(g)
3535

3636

37+
def callback_listener(item):
38+
with open('choice_logs.txt', 'a') as f:
39+
f.write(str(item) + '\n')
40+
41+
3742
questions = [
3843
inquirer.FilterList(
39-
"size",
44+
"food selection",
4045
message="Select item ",
4146
choices=choices,
4247
carousel=False,
43-
filter_func= filter_func,
48+
filter_func=filter_func,
49+
choice_callback=callback_listener
4450
),
4551
]
4652

0 commit comments

Comments
 (0)