i get to down as far as the tax equation and it won't run, any ideas??

from graphics import *

def main():
win=GraphWin("Taxation Calculator",300,240)
win.setCoords(0.0,0.0,3.0,4.0)
#draw interactive entry boxes
Text(Point(1,3),"Salary: ").draw(win)
input=Entry(Point(2,3),5)
input.setText("0000")
Output=Text(Point(2,1)," ")
Output.draw(win)
Button=Text(Point(1.5,2.0), "Calculate Tax")
Button.draw(win)
Rectangle(Point(1,1.5),Point(2,2.5)).draw(win)

#wait for mouse click
win.getMouse()

#convert Tax
amount= eval(input.getText())
if amount <= 20000:
print "you pay no tax"

elif amount > 20000 <= 40000:
tax = (amount /100.0) * 30.0)
print "you pay this amount in tax",tax

elif amount > 40000 <= 80000:
tax =(amount/100.0) * 40.0)
print "you pay this amount in tax",tax

else amount < 80000:
tax =(amount/100.0) * 50.0)
print "you pay this amount in tax",tax

output.setText("%0.1% tax)
button.setText("Quit")
win.getMouse()
win.close()
main()

I think it has been said here numerous times, but the module graphics.py is a subset wrapper for Tkinter from a older book. Not too many folks use it, so help will be difficult to get.

i get to down as far as the tax equation and it won't run, any ideas??

I have an idea, and that idea is "please wrap your program in code tags."

i get to down as far as the tax equation and it won't run,

And you'll have to be more specific. "Won't run" does not say enough and where in hell is the tax equation. Include the error message at the very least (which I am sure is a syntax error, so the question should be, "why do I get this syntax error on this line number in the program").

...where in hell is the tax equation...

Massachusetts.

Seriously, this line:

output.setText("%0.1% tax)

should read

output.setText("%0.1f" % tax)

I think.

Use print statements to figure out where the problem is exactly.

Jeff

This article has been dead for over six months. Start a new discussion instead.