***Fuel Cost Estimate Log Slot Calculator 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 signclude your wiki MONIKER in youser-na comment with the same courtesy that I will give you. Its very hard to reply intelligibly without some background of the correspondent. Thanks,[gold]
----
<<TOC>>
----
**Introduction**
----
[gold] Here is an eTCL script on fuel cost estmates.
----
In planning
----
***Screenshots Section***
----
****figure 1.****
[Fuel Cost Estimate Log Slot Calculator Example TCL WIKI screen.png%|% width=800 height=400]
----
***References:***
----
****Appendix TCL programs and scripts ****
****Pretty Print VERSION****
======
# indent test from ased editor
# fuel cost calculator
# written on Windows XP on eTCL
# working under TCL version 8.5.6 and eTCL 1.0.1
# gold on TCL WIKI , 16aug2010
frame .frame -relief flat -bg aquamarine4
pack .frame -side top -fill y -anchor center
set names {{} {daily_km:} {gas_tank_liters:} {day_fillup:} {cost_per_liter:} {cost_per_km:} {cost_per_km:} {answer cost/km:}}
foreach i {1 2 3 4 5 6 7} {
label .frame.label$i -text [lindex $names $i] -anchor e
entry .frame.entry$i -width 35 -textvariable side$i
grid .frame.label$i .frame.entry$i -sticky ew -pady 2 -padx 1
}
proc about {} {
set msg "Calculator for fuel cost from TCL WIKI, written on eTCL "
tk_messageBox -title "About" -message $msg
}
proc strat5 { xx1 } {
global side1 side2 side3 side4 side5 side6 side7
set ss side1
set tt $side2
set side4 [ expr { $side5*1. } ]
set side5 [ expr { $side2*$side4/$side1 } ]
set side6 [ expr { $side2*$side4/$side1 } ]
set side7 [ expr { $side2*$side4/$side1 } ]
set side7 [ expr { $side2*$side4/$side1 } ]
return $side7
}
proc calculate {} {
global answer2
global side1 side2 side3 side4 side5 side6 side7
set answer2 5
set answer2 [ strat5 $side1 ]
set side6 $answer2
}
proc fillup {aa bb cc dd ee ff gg} {
.frame.entry1 insert 0 "$aa"
.frame.entry2 insert 0 "$bb"
.frame.entry3 insert 0 "$cc"
.frame.entry4 insert 0 "$dd"
.frame.entry5 insert 0 "$ee"
.frame.entry6 insert 0 "$ff "
.frame.entry7 insert 0 "$gg "
}
proc clearx {} {
foreach i {1 2 3 4 5 6 7} {
.frame.entry$i delete 0 end
}
}
proc reportx {} {
console show;
puts " "
}
frame .buttons -bg aquamarine4
::ttk::button .calculator -text "Solve" -command calculate
::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 50. 15. 2. 3.1 15. 5. 40.}
::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 100. 1. 4. 5.2 15. 5. 40.}
::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 1000. 1. 5. 6.4 15. 5. 40.}
::ttk::button .clearallx -text clear -command clearx
::ttk::button .about -text about -command about
::ttk::button .cons -text report -command reportx
::ttk::button .exit -text exit -command exit
pack .calculator -in .buttons -side top -padx 10 -pady 5
pack .clearallx .cons .about .exit .test4 .test3 .test2 -side bottom -in .buttons
grid .frame .buttons -sticky ns -pady {0 10}
. configure -background aquamarine4 -highlightcolor brown -relief raised -border 30
wm title . "fuel cost calculator"
======
[gold] This page is copyrighted under the TCL/TK license terms, [http://tcl.tk/software/tcltk/license.html%|%this license].
**Comments Section**
<<discussion>>
Please place any comments here, Thanks.
----
<<categories>> Numerical Analysis | Toys | Calculator | Mathematics| Example| Toys and Games | Games | Application | GUI
----
<<categories>> Development | Concept| Algorithm