答えて
QMessageBoxは、いくつかの情報メッセージを表示し、必要に応じてその上に標準のボタンのいずれかをクリックすることで対応するようにユーザーに依頼する一般的に使用されるモーダルダイアログです。各標準ボタンには、定義済みのキャプションと役割があり、定義済みの16進数が返されます。
QMessageBoxクラスに関連する重要な方法と列挙次の表に記載されている -
S.No. Methods & Description
setIcon() Displays predefined icon corresponding to severity of the message
Question Question
Information Information
Warning Warning
Critical Critical
setText() Sets the text of the main message to be displayed
setInformativeText() Displays additional information
setDetailText() Dialog shows a Details button. This text appears on clicking it
setTitle() Displays the custom title of dialog
setStandardButtons() List of standard buttons to be displayed. Each button is associated with
QMessageBox.Ok 0x00000400
QMessageBox.Open 0x00002000
QMessageBox.Save 0x00000800
QMessageBox.Cancel 0x00400000
QMessageBox.Close 0x00200000
QMessageBox.Yes 0x00004000
QMessageBox.No 0x00010000
QMessageBox.Abort 0x00040000
QMessageBox.Retry 0x00080000
QMessageBox.Ignore 0x00100000
setDefaultButton() Sets the button as default. It emits the clicked signal if Enter is pressed
setEscapeButton() Sets the button to be treated as clicked if the escape key is pressed
ストレート非常に少なくともhere
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
def window():
app = QApplication(sys.argv)
w = QWidget()
b = QPushButton(w)
b.setText("Show message!")
b.move(50,50)
b.clicked.connect(showdialog)
w.setWindowTitle("PyQt Dialog demo")
w.show()
sys.exit(app.exec_())
def showdialog():
msg = QMessageBox()
msg.setIcon(QMessageBox.Information)
msg.setText("This is a message box")
msg.setInformativeText("This is additional information")
msg.setWindowTitle("MessageBox demo")
msg.setDetailedText("The details are as follows:")
msg.setStandardButtons(QMessageBox.Ok |
QMessageBox.Cancel)
msg.buttonClicked.connect(msgbtn)
retval = msg.exec_()
print "value of pressed message box button:", retval
def msgbtn(i):
print "Button pressed is:",i.text()
if __name__ == '__main__':
window()
nice、btwどうすればこの疑問符をコーディングできますか?ボタン:P – w33z
これまでのコードを私に送信できますか? – Angrywasabi
それがあなたを助けるなら私の答えに例を加えました! – Angrywasabi
- 1. 疑問符プレースホルダー
- 2. 疑問符
- 3. .htaccess - 疑問符
- 4. 疑問符
- 5. 疑問符
- 6. mysqlの疑問符
- 7. ビジュアルスタジオデバッガの疑問符
- 8. エスケープ? hibernate/gormのSQL制限内の疑問符(疑問符)
- 9. シナトラと疑問符
- 10. 疑問符は5
- 11. ScalaのAkka、感嘆符と疑問符
- 12. 解析の疑問符(2)
- 13. 疑問符 "?" JS変数の
- 14. htaccessのリダイレクト疑問符
- 15. 方法:疑問符のフォームアクション
- 16. のFindFirstと疑問符
- 17. オプションの疑問符 - regexp
- 18. クリーンURLのPHP疑問符
- 19. SQLパラメータと疑問符
- 20. htmlフォーム - 疑問符と式
- 21. スカラ:型パラメータで疑問符
- 22. 疑問符とコロン - ルビー
- 23. 疑問符演算子
- 24. C++疑問符出力
- 25. Clojure疑問符矢印マクロ
- 26. Android NDKのデバッグとバックトレースの疑問符
- 27. 文字列の疑問符の回避
- 28. スカラのアンダースコア(_)と疑問符(???)の相違
- 29. .htaccessでの疑問符の一致
- 30. UIPickerViewの疑問符の表示
から、あなたはどのような「ポストからコード」をお見せなければなりません試してみました。ユーザーは、自分で問題を解決しようとしたことを示すことができます。 –