def encrypt_execute(self): self.freeze_controls() try: self._cipher = EncryptionTool( self._file_url.get(), self._secret_key.get(), self._salt.get() ) for percentage in self._cipher.encrypt(): if self.should_cancel: break percentage = "{0:.2f}%".format(percentage) self._status.set(percentage) self.status_label.update() if self.should_cancel: self._cipher.abort() self._status.set("Cancellation Successful !!") messagebox.showinfo("EncrypC", "Cancellation Successful !!") self._cipher = None self.should_cancel = False self.unfreeze_controls() return self._cipher = None self.should_cancel = False self._status.set("File Encryption Successful !!") messagebox.showinfo("EncrypC", "File Encryption Successful !!") except Exception as e: self._status.set(e) self.unfreeze_controls()