1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
import sys
from PySide6.QtWidgets import (QApplication,
QWidget, QPushButton, QVBoxLayout, QMessageBox)
class Window(QWidget):
def __init__(self):
super().__init__()
layout = QVBoxLayout()
self.setLayout(layout)
button = QPushButton('Show msgbox')
layout.addWidget(button)
button.clicked.connect(self.on_button_clicked)
def on_button_clicked(self):
msg_box = QMessageBox()
msg_box.setText('Some message')
msg_box.setStandardButtons(
QMessageBox.Yes |
QMessageBox.No |
QMessageBox.YesToAll |
QMessageBox.NoToAll)
ret = msg_box.exec()
print(ret)
if __name__ == '__main__':
app = QApplication(sys.argv)
main_window = Window()
main_window.show()
sys.exit(app.exec())
|