Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://330430]
Tux => $HOME
[Tanktalus]: great, now I'm going to have to convert html codes to text for display... :)
[choroba]: Can you steal the code from pm-cb-g?

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2017-09-25 21:18 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (291 votes). Check out past polls.