calculator.py help

Simon Brunning SBrunning at trisystems.co.uk
Tue Nov 14 06:13:45 EST 2000


> From:	dijkhuis at my-deja.com [SMTP:dijkhuis at my-deja.com]
> Can someone please help me with the following code?
> I found this example somewhere but it won't work.
> It is supposed to be a calculator.
 
(snip)

I assume that you got this from
<http://www.sunworld.com/sunworldonline/swol-02-1998/swol-02-python_p.html>.
I asked the same question myself a while back, and the inimitable effbot
gave me the following response...

'if you look at the HTML source, you'll find that the line was
supposed to be:

entry.bind("<Key-Return>", evaluate)

but the script is still buggy; to make the "submit" button work, you have to
change the evaluate command to:

def evaluate(event=None):
label['text'] = "Result: " + str(eval(expression.get())) 

</F>'
Cheers,
Simon Brunning
TriSystems Ltd.
sbrunning at trisystems.co.uk





-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.




More information about the Python-list mailing list