Azad Rasul


18- Building a dialog box

Azad Rasul's photo
Azad Rasul

Published on Jun 25, 2021

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Building a dialog box to asking want to save changes:

qmb = QMessageBox()
qmb.setText('Want to save your changes?')
qmb.setStandardButtons(QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel)
return_value = qmb.exec()

if return_value == QMessageBox.Save:
    print("You pressed Save")
elif return_value == QMessageBox.Discard:
    print("You pressed Discard")
    print('You pressed Cancel')
Share this
Proudly part of