Calc¶
-
class
decida.Calc.
Calc
(parent=None, **kwargs)¶ Bases:
decida.ItclObjectx.ItclObjectx
synopsis:
Scientific calculator.Calc is an algebraic-mode calculator with 50 buttons, a small menu of additional functions, a menu of constants, and a help display. Calc instances can be embedded in other tk windows. The calculators can be operated with mouse or keyboard entry.
The DeCiDa application calc simply instantiates one Calc object.
constructor arguments:
parent (tk handle, default=None)
handle of frame or other widget to pack plot in. if this is not specified, top-level is created.**kwargs (dict)
keyword=value specifications: options or configuration-optionsoptions:
wait (bool, default=True)
If True, wait in main-loop until window is destroyed.configuration options:
verbose (bool, default=False)
Enable/disable verbose mode. (Not currently used.)example:
>>> from decida.Calc import Calc >>> Calc()
buttons:
OFF
Dismiss the calculator. Shuts down the main-loop.AC
All clear: clear display accumulator, memory accumulator, and calculator stack.CE
Clear entry: clear display accumulator.HELP
Display help window: button / keystroke map.MENU
Menu of additional functions. Currently these are:
random number:
Enter a random number between 0 and 1 into the display accumulator.
random seed:
Use the display accumulator value as a random seed.
list stack:
Display the calculator stack.
set precision:
Use the display accumulator value as a number of digits of precision in calculator evaluations.
logging:
Open a file to log the calculator evaluations.
const
Display constant dialog. Double click on a constant to enter it into the display accumulator.put
Put the current display accumulator number into constant memory. The const button can then be used to access its value.pi
Enter pi into the display accumulator.e
Enter e into the display accumulator.DRG
Change from degrees to radians to grads for trigonometric functions.HYP
Toggle hyperbolic mode. If sin, cos, or tan buttons are then invoked, the evaluation is of sinh, cosh, or tanh. If arc and hyperbolic mode are both on, then evaluation is of asinh, acosh, or atanh.ARC
Toggle arc mode. If sin, cos, or tan buttons are then invoked, the evaluation is of asin, acos, or atan. If arc and hyperbolic mode are both on, then evaluation is of asinh, acosh, or atanh.sin cos tan
Trigonometric, inverse-trigonometric (arc mode on), hyperbolic (hyperbolic mode on), or inverse-hyperbolic (arc and hyperbolic modes both on).sqrt
Square root of the display accumulator.x!
Factorial of the (integer value of the) display accumulator.10^x
10 to the power of the display accumulator.exp
e to the power of the display accumulator.x^2
Square of the display accumulator.1/x
Inverse of the display accumulator.log
Logarithm to the base ten of the display accumulator.ln
Natural logarithm of the display accumulator.y^x
Push the current display accumulator value onto the stack, evaluate the stack value raised to the power of the display accumulator value.M+
Add the display accumulator to the memory accumulator.M-
Subtract the display accumulator from the memory accumulator.STO
Store the display accumulator to the memory accumulator.RCL
Recall the memory accumulator to the display accumulator.XCH
Exchange the memory accumulator with the display accumulator.CLR
Clear the memory accumulator.( )
Algebraic parentheses.0 1 2 3 4 5 6 7 8 9 EE +/-
Numerical entry.+ - * /
Binary arithmetic operations.=
Evaluate the calculator stack.