1#!/usr/bin/env python 2""" 3Similar to the autocompletion example. But display all the completions in multiple columns. 4""" 5from __future__ import unicode_literals 6 7from prompt_toolkit.completion import WordCompleter 8from prompt_toolkit.shortcuts import CompleteStyle, prompt 9 10animal_completer = WordCompleter([ 11 'alligator', 'ant', 'ape', 'bat', 'bear', 'beaver', 'bee', 'bison', 12 'butterfly', 'cat', 'chicken', 'crocodile', 'dinosaur', 'dog', 'dolphin', 13 'dove', 'duck', 'eagle', 'elephant', 'fish', 'goat', 'gorilla', 'kangaroo', 14 'leopard', 'lion', 'mouse', 'rabbit', 'rat', 'snake', 'spider', 'turkey', 15 'turtle', 16], ignore_case=True) 17 18 19def main(): 20 text = prompt('Give some animals: ', completer=animal_completer, 21 complete_style=CompleteStyle.MULTI_COLUMN) 22 print('You said: %s' % text) 23 24 25if __name__ == '__main__': 26 main() 27