QtGui.QMessageBox.information以及定制i

2024-10-01 09:23:02 发布

您现在位置:Python中文网/ 问答频道 /正文

根据doucmentation,可以使用QtGui.QMessageBox.information()函数创建一个包含许多按钮的对话框,使用以下常量:

QMessageBox.Ok  An “OK” button defined with the AcceptRole .
QMessageBox.Open    A “Open” button defined with the AcceptRole .
QMessageBox.Save    A “Save” button defined with the AcceptRole .
QMessageBox.Cancel  A “Cancel” button defined with the RejectRole .
QMessageBox.Close   A “Close” button defined with the RejectRole .
QMessageBox.Discard     A “Discard” or “Don’t Save” button, depending on the platform, defined with the DestructiveRole .
QMessageBox.Apply   An “Apply” button defined with the ApplyRole .
QMessageBox.Reset   A “Reset” button defined with the ResetRole .
QMessageBox.RestoreDefaults     A “Restore Defaults” button defined with the ResetRole .
QMessageBox.Help    A “Help” button defined with the HelpRole .
QMessageBox.SaveAll     A “Save All” button defined with the AcceptRole .
QMessageBox.Yes     A “Yes” button defined with the YesRole .
QMessageBox.YesToAll    A “Yes to All” button defined with the YesRole .
QMessageBox.No  A “No” button defined with the NoRole .
QMessageBox.NoToAll     A “No to All” button defined with the NoRole .
QMessageBox.Abort   An “Abort” button defined with the RejectRole .
QMessageBox.Retry   A “Retry” button defined with the AcceptRole .
QMessageBox.Ignore  An “Ignore” button defined with the AcceptRole .
QMessageBox.NoButton    An invalid button.

它支持许多功能。在

我已经使用了^{}类的文档。在

我的问题是如何更改消息框中按钮的文本?在


Tags: thenoansavewithbuttonopenall
1条回答
网友
1楼 · 发布于 2024-10-01 09:23:02

你需要的是^{}。在

编辑:

感谢Bakuriu指出这一点。在

上面提到的setButtonText方法在与根据Qt4.3或更早版本编译的PyQt/PySide库一起使用时可以工作。Source。在

对于以后的版本,更改按钮的文本将涉及:

{a4}

^{}

相关问题 更多 >