Updated 2016-04-20 18:35:32 by gold

Easy Eye Calculator and eTCL Slot Calculator Demo Example edit

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 in your comment with the same courtesy that I will give you. Its very hard to reply intelligibly without some background of the correspondent. Thanks,gold

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: 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.

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

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

Screenshots Section


figure 1.



References:


Appendix Code edit

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}
        namespace eval liner {
            console show
            proc initdisplay {} {
                pack [entry .e -textvar e -width 50 ]
    bind .e <Return> {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 <FocusIn> {
            %W configure -background SystemHighlight -foreground SystemHighlightText
        }
        bind Label <FocusOut> {
            %W configure -background SystemButtonFace -foreground SystemButtonText
        }
        bind Label <Control-c> {
            clipboard clear
            clipboard append [%W cget -text]
        }
        bind Label <Control-p> {
            #clipboard clear
            clipboard append [%W cget -text]
        }
        bind Label <Control-q> {
            #clipboard exit
            clipboard append [%W exit]
        }
        console show
        console eval {.console config -bg palegreen}
        console eval {.console config -font {fixed 20 bold}}
        console eval {wm geometry . 40x20}
        linershell         


gold This page is copyrighted under the TCL/TK license terms, this license.

Comments Section edit

Please place any comments here, Thanks.