简体   繁体   English

tkmessagebox askquestion 有多个答案

[英]tkmessagebox askquestion with multiple answers

I've been trying to get tkmessagebox.askquestion to ask a question where there are more answers than 'yes' and 'no.'我一直在尝试让 tkmessagebox.askquestion 提出一个问题,其中的答案比“是”和“否”要多。 I know that askquestion returns a string 'yes' when yes is clicked, and I'm trying to add more buttons to that dialogue box.我知道当点击 yes 时 askquestion 返回一个字符串“是”,我正在尝试向该对话框添加更多按钮。 Can this even be done with tkmessagebox?这甚至可以用 tkmessagebox 来完成吗? How could I add more button options (ie, 'pass' and 'abstain' in addition to 'yes' and 'no')?我怎样才能添加更多按钮选项(即,除了“是”和“否”之外,还有“通过”和“弃权”)?

No, it is not possible with tkMessageBox.不,tkMessageBox 是不可能的。

The type option of the Dialog class (used by tkMessageBox) only allows the values abortretryignore , ok , okcancel , retrycancel , yesno , and yesnocancel . Dialog 类的类型选项(由 tkMessageBox 使用)仅允许值abortretryignoreokokcancelretrycancelyesnoyesnocancel 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.您可以将它们与 Dialog 子类一起使用,但如果您想显示更多按钮,我建议您使用 Toplevel 小部件并将它们添加到窗口或定义您自己的类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM