Someone Something wrote:
I'm writing a simple tax calculator with Tkinter (just for fun). Here's my current code:
[snip]
def printResult(self): if self.nrate is None | self.nincome is None:
There's no such attribute as nrate or nincome. Also, "|" is the bitwise operator. You probably intended "or" instead.
print "Clear everything and start again."; print "Don't fool around with me."; else: self.nresult=float(((100-self.nrate)/100)*self.nincome); self.result.insert(END, str(self.nresult));
Try this instead: def printResult(self): try: rate = float(self.rate.get()) income = float(self.income.get()) result = ((100.0 - rate) / 100.0) * income self.result.insert(END, str(result)) except ValueError: print "Clear everything and start again." print "Don't fool around with me." -- http://mail.python.org/mailman/listinfo/python-list