**Easy Eye Calculator and eTCL Slot Calculator Demo Example** This page is under development. Comments are welcome, but please load any comments in the comments section at the bottom of the page. Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Aside from your courtesy, your wiki MONIKER and date as a signature and minimal good faith of any internet post are the rules of this TCL-WIKI. Its very hard to reply reasonably without some background of the correspondent on his WIKI bio page. Thanks, [gold] 26Sep2020 ---- <> ---- [gold] Here is some eTCL starter code for an easy eye calculator, includes large black font on green background. The human eye is peaked for yellow/green and various ergonomic studies have shown that black font on green background is one of the easiest to read. My small notepad has a linked script and icon for easy eye calculator, posted on the windows desktop of small screen, 22 by 12 cm. One advantage of the easy eye calculator is that the calculations are posted to a console window as a sort of paper tape. The easy eye calculations can be cut and paste, saved to a word processor. The easy eye calculator is a compilation of several eval calculators on the TCL wiki. ---- **** Improvements No 1: math operator notation **** The math operator notation from "namespace path {::tcl::mathop ::tcl::mathfunc}" is available on the green screen. Once the math expression is typed from the keyboard into the green window, the mouse pointer can be set down in the green calculator window and the expression altered. For example, [[* 2. 5.0 ]] can be altered to [[* 2. 5.7777]] on the keyboard. I have been unable to screen grab or screen copy the results in the green window, maybe somebody can show how to achieve this. I understand that the TCL console is compiled in a different interpreter or thread than the TCL application, but I would like to forward complex math expressions from the console to the green window. Possibly, entering one symbol like > (right arrow) or ^ (hat) to transfer and expression to the green window. For example, type "> [[* 2. 5.7777 ]]" or > 2./5. on the keyboard and transfer expression to the green screen. Also, type erase on console and clear green screen. ---- **** Improvements No. 2: Added statements for precision and math library. **** ---- Note spaces near expr statement must be maintained or program deck will not work, blanks _b here {expr _b _b } . ====== package require math::calculus package require math::constants package require math::statistics package require math::special package require math::numtheory set tclprecision 17 namespace path {::tcl::mathop ::tcl::mathfunc } ====== ---- **** Improvements No. 3, underway from posted [Ask, and it shall be given # 12] **** [gold] 11 nov 2017, I have a wiki page called [Easy Eye Calculator and eTCL Slot Calculator Demo Example, Numerical Analysis ]. I know I can add a help button to the [Windows Wish Console], but is there modify or add to the help:about popup? Thanks, something like ====== proc self_helpx {} { set msg2 " self help pi invoked as [ pi ] console, > 1/9 transfer entries to green screen console, e> erase green screen console, q> quits program console, > (2*3)+(3*3) transfer entries to green screen conventional text editor formulas can be pasted into green console and transferred (cmd > ) to green line for calculation. should be space between > and entries Note spaces near expr statement must be maintained or program deck will not work, blanks _b must be here {expr _b _b } " console eval {.console configure -txt $msg2 } } [ self_helpx ] ====== [MG] You can use the [console eval] command to run commands in the console interpreter, and then use a little introspection to find and tweak the menu: ====== (Mike) 1 % console eval {. config -menu} -menu menu Menu {} .menubar (Mike) 2 % console eval {.menubar entrycget "Help" -menu} .menubar.help (Mike) 3 % console eval {.menubar.help entryconfig 1 -command} -command {} {} {} tk::ConsoleAbout (Mike) 4 % console eval {proc foo {} {.console insert end "\nText Here\n" ; .console see end}} (Mike) 5 % console eval {.menubar.help entryconfig 1 -command foo} ====== [gold] Subroutine so far, similar cosmetics to original console and added label for self_help. ====== console eval { proc self_helpx {} { set msg "easy eye calculator, large black type on green from TCL WIKI, self help pi invoked as \[ pi \] console, > 1/9 transfer entries to green screen console, e> erase green screen console, q> quits program console, > (2*3)+(3*3) transfer entries to green screen conventional text editor formulas can be pasted into green console and transferred (cmd > ) to green line for calculation. should be space between > and entries Note spaces near expr statement must be maintained or program deck will not work " tk_messageBox -title "self_helpxx" -message $msg } } console eval {.menubar.help add command -label Self_help -command self_helpx } ====== ---- [gold] 10/25/2020. The easy eye calculator code is the original bare bones display because it was thought that the user could get up and working calculator faster without a lot of tweaks, help button comments, and library references. The shorter the code list, the faster and more reliable is the easy eye calculator. Some of the possible improvements and additional code statements for a local setup are listed as auxiliary source code on this page. There are several Wiki pages that show this easy eye calculator used as a testbed for other wiki pages, used to make displays, or linked to TCLLIB library functions. See Compendium [https://wiki.tcl-lang.org/page/One+Liners+Programs+Compendium++and+TCL+demo+examples+calculations%2C+numerical+analysis] and Testbed [https://wiki.tcl-lang.org/page/Testbed+for+Little_Math_Language+V2+and+TCL+demo+examples+calculations%2C+numerical+analysis+ed2]. Also [https://wiki.tcl-lang.org/page/Call+Procedure+Like+Fortran+Example]& [https://wiki.tcl-lang.org/page/Basic_RS+V2+in+TCL+as+partial+Basic+language+interpreter+ed] & [https://wiki.tcl-lang.org/page/Playing+Recursion+V2++%3E%3E++demo+examples+for+one+liner+programs] ---- ***Testcases Section*** In planning any software, it is advisable to gather a number of testcases to check the results of the program. The math for the testcases can be checked by pasting statements in the TCL console. Aside from the TCL calculator display, when one presses the report button on the calculator, one will have console show access to the capacity functions (subroutines). **** Testcase 1 **** ====== console, > 1/9 transfer entries to green screen should be space between > and entries ====== **** Testcase 2 **** ====== console, e> erase green screen ====== **** Testcase 3 **** ====== console, q> quits program ====== **** Testcase 4 **** ====== console, > (2*3)+(3*3) transfer entries to green screen should be space between > and entries ====== ---- ***Screenshots Section*** ---- ****figure 1. Easy Eye Calculator**** [Easy Eye Calculator and eTCL Slot Calculator TCL WIKI screen.png%|% width=800 height=200] ---- ****figure 2. Easy Eye Calculator V2 , modified version **** ---- [Command Line Calculator in Namespace Package Example] ---- [Command Line Calculator in Namespace Package Example screen.png] ---- ***References:*** * Command Line Calculator in Namespace [https://wiki.tcl-lang.org/page/Command+Line++Calculator+in+Namespace+Package+Example] * Ask Dr. Math, 03/15/2001, material left on roll. * [console eval] * [A little calculator] * [tclsh as a powerful calculator] * http://www.spsu.edu/cs/faculty/bbrown/web_lectures/postfix/ * http://en.wikipedia.org/wiki/Polish_notation, 1924 * [expr] * [Importing expr functions] * [RPN] * [Parsing Polish notation] * [Category Package] * [Importing expr functions, part 2] * [Call Procedure Like Fortran Example] * [namespace] * [package] * http://docs.activestate.com/activetcl/8.5/tcllib/math/constants.html * [tcl::mathop] * [tcl::mathfunc] * [Namespace resolution of Variables & Procedures] * [http://en.wikibooks.org/wiki/Tcl_Programming/expr] * [A little calculator] * [A minimal console] * Compendium [https://wiki.tcl-lang.org/page/One+Liners+Programs+Compendium++and+TCL+demo+examples+calculations%2C+numerical+analysis] * Testbed [https://wiki.tcl-lang.org/page/Testbed+for+Little_Math_Language+V2+and+TCL+demo+examples+calculations%2C+numerical+analysis+ed2] * Call Fortran Procedure [https://wiki.tcl-lang.org/page/Call+Procedure+Like+Fortran+Example] * Basic_RS [https://wiki.tcl-lang.org/page/Basic_RS+V2+in+TCL+as+partial+Basic+language+interpreter+ed] * Playing Recursion V2 [https://wiki.tcl-lang.org/page/Playing+Recursion+V2++%3E%3E++demo+examples+for+one+liner+programs] ---- **Appendix Code** ***appendix TCL programs and scripts *** ====== # pretty print from autoindent and ased editor # easy eye calculator, large black type on green # written on Windows XP on eTCL # working under TCL version 8.5.6 and eTCL 1.0.1 # gold on TCL WIKI , 2may2014 package require Tk package provide calculatorliner 1.0 namespace path {::tcl::mathop ::tcl::mathfunc} set tclprecision 17 namespace eval liner { console show proc initdisplay {} { pack [entry .e -textvar e -width 50 ] bind .e {puts $e;catch {expr [string map {/ *1./} $e] } res; set e $res;puts $res} ;# RS & FR } } proc linershell {} { namespace import liner::* liner::initdisplay .e configure -bg palegreen .e configure -fg black .e configure -font {helvetica 50 bold} .e configure -highlightcolor tan -relief raised -border 30 focus .e wm title . "Easy Eye Calculator" proc pi {} { expr acos(-1) } proc > {args} { global e set e $args} proc e> {args} { global e set e ""} proc q> {args} { exit} } bind Label <1> {focus %W} bind Label { %W configure -background SystemHighlight -foreground SystemHighlightText } bind Label { %W configure -background SystemButtonFace -foreground SystemButtonText } bind Label { clipboard clear clipboard append [%W cget -text] } bind Label { #clipboard clear clipboard append [%W cget -text] } bind Label { #clipboard exit clipboard append [%W exit] } console show console eval { proc self_helpx {} { set msg "easy eye calculator, large black type on green from TCL WIKI, self help pi invoked as \[ pi \] console, > 1/9 transfer entries to green screen console, e> erase green screen console, q> quits program console, > (2*3)+(3*3) transfer entries to green screen conventional text editor formulas can be pasted into green console and transferred (cmd > ) to green line for calculation. should be space between > and entries Note spaces near expr statement must be maintained or program deck will not work " tk_messageBox -title "self_help" -message $msg } } console eval {.menubar.help add command -label Self_help -command self_helpx } console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} console eval {. configure -background orange -highlightcolor brown -relief raised -border 30} linershell ====== ---- ---- ---- **Change Log Section** ---- [gold] 10/25/2020. added box outline to calculator display. ---- **Hidden Comments Section** <> Please place any comments here, Thanks. <> Numerical Analysis | Toys | Calculator | Mathematics| Example| Toys and Games | Games | Application | GUI ---- <> Development | Concept| Algorithm