Forum Archive

Multiple dialog choices

pipe

I’ve read the documentation but it’s not very clear ...
how do I make a dialog alert with multiple choices, and how am I supposed to use them?

Thanks in advance!

ccc

Can you please provide sample code of what you have so far?

mcriley821

If you’re talking about a list dialog, just assign a variable when you call it.

result = dialogs.list_dialog(title = 'Title', items = ['A', 'B', 'C'])

If you want like a system dialog, you should use the console module.
http://omz-software.com/pythonista/docs/ios/console.html#console.alert

mikael

@pipe, this alternative works for up to 3 different options.


import console

try:
    selection = console.alert(
        title='Your Choice',
        message='Which one do you want?', 
        button1='Option 1', 
        button2='Option 2', 
        button3='Option 3', 
    )
    print(f'You selected option {selection}')
except KeyboardInterrupt:
    print('It was too big a decision to make at this point of your life')

pipe

@mcriley821 thanks

origenrameroqr

Thank you for the explanation. It is clear for me.