checkbox.py 460 B

1234567891011121314151617181920
  1. from PyInquirer import prompt, Separator
  2. widget = [
  3. {
  4. 'type':'checkbox',
  5. 'name':'parts',
  6. 'message':'Choose parts to upgrade',
  7. 'choices':[Separator('= Weapons ='),
  8. {'name':'Laser'},{'name':'Beam'},{'name':'Shotgun'},
  9. Separator('= Others ='),
  10. {'name':'Thruster'}, {'name':'Shield'},
  11. {'name':'MedBay', 'disabled':'Already upgraded'},
  12. {'name':'FTL', 'cheked':True}]
  13. }
  14. ]
  15. result = prompt(widget)
  16. print('Your answer is')
  17. print(result["parts"])