Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Simple Calculator using Tk

by Albannach (Prior)
on Feb 20, 2004 at 01:53 UTC ( #330430=note: print w/ replies, xml ) Need Help??


in reply to Simple Calculator using Tk

A neat little job ++! Also a good choice of application for GUI practice with lots of scope for growth (consider adding a 'paper tape' feature, or date calculations for instance).

One minor thing (which bites me often too) - the generation of a bug via cut & paste. You duplicated the line to create all your menu commands, and consequently your Exit command is passed as a 'Q' button press. Unfortunately there is no 'Q' button, so the 'Q' is passed on to calc(), where it acts to clear the display and buffer.

Update: To clarify, there is nothing fundamentally wrong with cut & paste code generation, as long as you are aware of and checking carefully for this type of error. However, if you find yourself needing many copies of the same line with very minor changes, sometimes it indicates that you should consider a different structure.

--
I'd like to be able to assign to an luser


Comment on Re: Simple Calculator using Tk
Download Code
Re: Re: Simple Calculator using Tk
by eoin (Monk) on Feb 20, 2004 at 13:08 UTC
    Damn, I should have spoted that 'Q' typo. The 'Q' should be passed as a key press instead of a button press. I'll update the code correcting that.

    Regarding the cut and paste aspect. I didn;t really think about doing it any other way. I suppose I could have now that you say it, but this is the quickest and easiest(although not always the right, as you pointed out) way to do this.

    Cheers, Eoin...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://330430]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2014-12-22 07:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (112 votes), past polls