def add_cancel_button(self):
        """Add a cancel button at the bottom of the dialog window."""
        button_box = QDialogButtonBox(QDialogButtonBox.Cancel, self)
        button_box.rejected.connect(self.reject)
        self.layout.addWidget(button_box)
Add a cancel button at the bottom of the dialog window.