/
Spinogryz
/
Example-project
Обзор
Документация
Войти
/
Spinogryz
/
Example-project
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
q_message_box.py
33 строки
1 KB
Spinogryz
QFile added
18 фев 2025, 15:07
18 фев 2025, 15:07
47abb82
Код
Авторство
О чём код?
import sys from PyQt5.QtWidgets import * # import sections class DlgMain(QDialog): def __init__(self): super().__init__() self.resize(200, 200) self.btn = QPushButton('Show message', self) self.btn.move(35, 50) self.btn.clicked.connect(self.evt_btn_clicked) def evt_btn_clicked(self): # res = QMessageBox.question(self, 'Disk full', 'Your disk drive is almost full') # if res == QMessageBox.Yes: # QMessageBox.information(self, 'Result box', "You've clicked 'Yes' button") # elif res == QMessageBox.No: # QMessageBox.information(self, 'Result box', "You've clicked 'No' button") msg_disk_full = QMessageBox() msg_disk_full.setText('Your hard drive is almost full') msg_disk_full.setDetailedText('Please free up disk space') msg_disk_full.setIcon(QMessageBox.Information) msg_disk_full.setWindowTitle('Full drive') msg_disk_full.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) msg_disk_full.exec_() if __name__ == '__main__': app = QApplication(sys.argv) #create application dlgMain = DlgMain() # create main GUI window dlgMain.show() # show GUI sys.exit(app.exec_()) # execute the application