So guys.What I want to do is, ask if user wanted to reset the form values. If yes, reset, if no, popup a messagebox.information to confirm nothing happened.
def reset(self):
qm = QtGui.QMessageBox
qm.question(self,'', "Are you sure to reset all the values?", qm.Yes | qm.No)
if qm.Yes:
self.price_box.setText("0")
self.results_tax.setText("")
self.results_window.setText("")
self.tax_rate.setValue(21)
else:
qm.information(self,'',"Nothing Changed")
But for now, No matter what I choose, the form always got reseted. Anything wrong with my if statement? Thanx
It should be:
ret = qm.question(self,'', "Are you sure to reset all the values?", qm.Yes | qm.No)
if ret == qm.Yes:
Hope it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With