pick
pick copied to clipboard
Breaking out of the menu that is displayed.
Great utility "pick". Just wondering how to exit out of the menu that is displayed if the user decides that they do not want to pick anything because what they are looking for isn't being listed... like a list of USB drives. I have even tried a "try/except" block.
try:
title = 'Please choose Drive to write logs to ' + str(removable_volumes) + ': '
value, index = pick(values, title, indicator='=>')
except KeyboardInterrupt as error: # On ctrl-c from keyboard, flush buffer, close file, exit. Break loop.
print("\n\nExiting due to user action...")
Thanks, Bob
It's not supported but I think you can use register_custom_handler to achieve this.
Ok thanks. I guess I could also add a menu pick at the end like "Exit no pick" or something like that. Thanks :)