Pergunta

I've been trying to get tkmessagebox.askquestion to ask a question where there are more answers than 'yes' and 'no.' I know that askquestion returns a string 'yes' when yes is clicked, and I'm trying to add more buttons to that dialogue box. Can this even be done with tkmessagebox? How could I add more button options (i.e., 'pass' and 'abstain' in addition to 'yes' and 'no')?

Foi útil?

Solução

No, it is not possible with tkMessageBox.

The type option of the Dialog class (used by tkMessageBox) only allows the values abortretryignore, ok, okcancel, retrycancel, yesno, and yesnocancel. You can use these with your Dialog subclasses, but if you want to show more buttons I recommend you to use a Toplevel widget and add them to the window or define your own class.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top