jorge raul moreno -at- hot mail -dot- com
I heard that every android has a wish: to be ticklish...
This Android never suffered Pteronophobia (the fear of being tickled by feathers!)
Title | Author |
---|---|
Practical Programming in Tcl and Tk | Brent Welch |
Effective Tcl/Tk Programming | Mark Harrison/Michael McLennan |
Tcl/Tk for Real Programmers | Clif Flynt |
The Tcl Programming Language | Ashok P Nadkarni |
Effective Tcl/Tk Programming
for XML parsing
web scrapping
diagrams
WebServer
Static content
driving other windows application
Most used:
2013-12-07 A few of your favorite things about editing scripts with Tkcon
2014-06-25 Hack-O-Matic
2014-08-09 filewait
2014-08-22 Quick Formatting ANSI Colour Escape Strings
2014-08-22 cgrep - Color your output with regular expressions!
2014-10-03 WikIndent input line by line
2015-03-13 Freecell for a cross platform alternative to SystemButtonFace color
2015-03-13 Invoking browsers to launch firefox under linux
2015-10-15 vgrep: a visual grep
2016-11-17 serial ports on Windows
Matthias Hoffmann
2017-03-17 minimalist wget
2017-07-05 getopt to parse out switches from the command line (argv) by name
2017-07-11 LiSA
SWIG exemples http://wfr.tcl.tk/1693
'xpg' - a text file browser (includes awk) https://wiki.tcl-lang.org/38443 awk and shell script
2020-11-25 Domain Specific Language - https://medium.com/@jeffreybian/tcl-domain-specific-language-made-easy-820634556
Date | Page | tags |
---|---|---|
2017-12-20 | Editing the Tcl'ers Wiki using an editor of your choice | TBD |
2017-12-28 | w3m | automate web browser with Expect |
Date | Page | tags |
---|---|---|
2017-12-20 | Get CPU Temperature Statistics | sqlite |
2017-12-28 | Paging with TkTreeCtrl + SQlite | CREATE TABLE IF NOT EXISTS |
2015-01-13 | Heronian triangles | TBD |
6/7/2018 Web HTML http
Firmata
Interfacing PS2 Keyboard with Arduino and Androwish
JeeMon
A scale with Arduino and AndroWish
Filtering measurement values with a 1D Kalman filter
BLT-newbie - barchart: How to display value under mouse cursor
http://computer-programming-forum.com/57-tcl/b286e0c308f1604e.htm
BLT graph: Problem setting colors using RGB notation
http://computer-programming-forum.com/57-tcl/790b8f5784d4984a.htm
BLT vector creation: creation time grows as number of vectors created grows
http://computer-programming-forum.com/57-tcl/326d86938e3c7375.htm
''My quick reference''
My quick reference
'''My formatting guide'''
My formatting guide
xxxd.xItem1
puts "Tcl is great!"
puts "did I mention that Tcl is great?"
puts "Tcl/Tk"
Links:
For Formatting Rules click here or here
JM 22 Jul 2011 - I was just playing a little bit with tclhttpd by putting the following code on the file: \htdocs\cgi-bin\test.cgi
package require tclodbc set driver "Microsoft Access Driver (*.mdb)" set dbfile "C:\\Program Files\\Microsoft Office\\office11\\samples\\Northwind.mdb" puts [html::h3 "getting info from Access through tclODBC..."] puts "<table border=1 cellpadding=4>" database connect db "DRIVER=$driver;DBQ=$dbfile" foreach rec [db "select EmployeeID,LastName,FirstName FROM Employees;"] { puts "<tr>" foreach field $rec { puts "<td>$field</td>" } puts "</tr>" } puts "</table>" db disconnect
just after the following existing lines:
puts [html::h1 "Hello, World!"] puts [html::h2 [clock format [clock seconds]]]
and I got a dynamic page that queries the database that comes as a sample with the Microsoft Access installation.
you can get there by means of the CGI link on the home page, then through the Sample form posted to test.cgi and finally hitting the "Submit Query" button.
JM 7 Sep 2013 - pscp from the putty family of tools, see also plink
console show proc action {} { cd c:/putty set f [open "|\"pscp.exe\" -l jorge -pw yourpwd [.from get]:[.path get] ."] puts done } entry .from entry .path -width 50 button .button -text get -command action .from insert 0 [email protected] .path insert 0 /home/jorge/sample.txt pack .from .path .button
JM 26 Oct 2013 - I dont know why, but I had to put some puts commands after the source command to make it work, if not, I was getting an error saying that the gnuplot commmand did not exist
console show #set gpexe C:/gnuplot-4.0/bin/pgnuplot.exe set gpexe "C:/Program Files (x86)/gnuplot/bin/pgnuplot.exe" #set outfile C:/data/resultat.tk set outfile "C:/Users/jmoreno/Documents/code/gnuplot/resultat.tk" set gp [open "|\"$gpexe\"" r+] puts $gp "set term tk" puts $gp "set output '$outfile'" puts $gp "set noborder\nset zeroaxis" puts $gp "set xtics 1\nset ytics .5" puts $gp "plot \[-2:2\] atan(x)" close $gp pack [canvas .c] source $outfile puts $outfile puts [info commands gnu*] update gnuplot .c
JM 7 Nov 2014 - Looks like the real fix is this (just waiting a little, to let pgnuplot.exe to completely close):
console show #set gpexe C:/gnuplot-4.0/bin/pgnuplot.exe set gpexe "C:/Program Files (x86)/gnuplot/bin/pgnuplot.exe" #set outfile C:/data/resultat.tk set outfile "C:/Users/jmoreno/Documents/code/gnuplot/resultat.tk" set gp [open "|\"$gpexe\"" r+] puts $gp "set term tk" puts $gp "set output '$outfile'" puts $gp "set noborder\nset zeroaxis" puts $gp "set xtics 1\nset ytics .5" puts $gp "plot \[-2:2\] atan(x)" close $gp after 1000 pack [canvas .c] source $outfile #puts "we are at: [pwd]" #puts $outfile #puts [info commands gnu*] #update gnuplot .c
JM 18 Feb 2014 - The following example was good for me to try the basics
Remote input-output with Expect
JM 26 Feb 2017 - from:
https://groups.google.com/forum/#!topic/comp.lang.tcl/B6afDJQg8LA
package require http console show set organism_name "nipah" set xml " <?xml version=\"1.0\" encoding=\"UTF-8\"?> <orgPdbQuery> <version>B0905</version> <queryType>org.pdb.query.simple.OrganismQuery</queryType> <description>Organism Search : Organism Name=$organism_name </description> <organismName>$organism_name</organismName> </orgPdbQuery> " set url "http://www.rcsb.org/pdb/rest/search" set tok [::http::geturl $url -query $xml -type application/x-www-form-urlencoded] set rep [::http::data $tok] puts "[::http::status $tok]" puts $rep ::http::cleanup $tok
% package require tablelist 5.13 % package ifneeded tablelist 5.13 package provide tablelist 5.13;source -encoding utf-8 C:/Tcl/lib/teapot/package/tcl/teapot/tcl8/8.0/tablelist-5.13.tm % C:\Tcl\lib\teapot\package\tcl\lib\tablelist_common5.13
1 | wiki-reaper | tbd |
2 | Web Scraping with htmlparse | withatt type |
3 | https://github.com/jtcl-project/jtcl/blob/master/src/main/resources/tcl/pkg/tcllib/library/page/util_norm_peg.tcl | over n |
JM 20 Nov 2020 - This is mostly code from miniMu
package require mupdf console show set pdfFileName [tk_getOpenFile -filetypes {{Pdf .pdf}}] set pdf [mupdf::open $pdfFileName] set pageQty [$pdf npages] for {set i 0} {$i < $pageQty} {incr i} { set page [$pdf getpage $i] ;# 0 is the 1st page set ctr 0 foreach imagen [$page images list] { puts $imagen set id [$page images extract -id [lindex $imagen 0] -as "img$i-[lindex $imagen 1]"] incr ctr } }
JM 20 Nov 2020 - grepGUI based on RS's code from grep
console show set W 30 set H 100 set X 0 set Y 0 console eval { set W 80 set H 70 set X 0 set Y 0 wm geometry . ${W}x$H+$X+$Y } label .mask_label -text "Files:" -justify right label .patt_label -text "Regular expression:" entry .files -textvariable filemask button .btn -text grep! -command { console eval { .console delete 1.0 end } main refile.txt [.files get] } text .txt1 -height 10 grid .mask_label -row 0 -column 0 -sticky e grid .files -row 0 -column 1 -sticky w grid .btn -row 0 -column 2 grid .patt_label -sticky w grid .txt1 - - #defaults set filemask "*.log" .txt1 insert end "^C\[XL\]\n" .txt1 insert end "ERROR:\n" .txt1 insert end "Test Case:\n" .txt1 insert end "Other\n" proc main {refile fileGlob} { puts [.txt1 get 1.0 end] set REset [split [string trim [.txt1 get 1.0 {end-1 char}]] \n] set files [eval glob -types f $fileGlob] foreach file $files { puts "============ $file" set fp [open $file] grep-f $REset $fp close $fp } } proc grep-f {REset fp} { while {[gets $fp line] >= 0} { foreach RE $REset { if {[regexp $RE $line]} { puts $line break } } } }
JM 26 Nov 2020 - based on Maritime Signal Flags
for this to work, you will need the 54 images named lotenn.jpg
##################################################################### # Creador de Cartas de Loteria # # # Mostly based on: # Marine Signal Flags & Flag System # # 2002-11-05 Keith Vetter # 2005-06-10 HJG: Numeric Flags + some extra Chars (Answer...) ##################################################################### package require Tk package require Img console show for {set i 1} {$i < 55} {incr i} { set ctr [format "%02d" $i] lappend parms [list flower$i xColor lote$ctr.jpg] } # ------------- # create images from files # ------------- set i 0 foreach item $parms \ { foreach {name color file} $item break lappend list [incr i] set names($i) $name set colors($i) $color set files($i) $file } foreach i $list { # tk_messageBox -message "$i $names($i) $files($i)" image create photo $names($i) -file $files($i) set image $names($i) set ww [image width $image] set hh [image height $image] # create the mini image from the full image foreach {type factor} {mini 3} \ { set ww2 [expr {$ww / $factor}] set hh2 [expr {$hh / $factor}] image create photo ${type}$i -width $ww2 -height $hh2 ${type}$i copy $image -subsample $factor } } proc Flags {letter row col} { if {$letter == ""} { puts "$letter $row $col" } set xy [Shift $row $col 40 80] puts $xy .c create text $xy -text $letter -anchor c -tag lbl -font {Times 12 bold} .c create image $xy -image mini$letter } # Shift - Shift coords over to a given row,col cell proc Shift {row col args} { set drow 100 set dcol 80 set x0 [expr {$col * $dcol}] set y0 [expr {$row * $drow}] set result {} foreach {dx dy} $args { lappend result [expr {$x0 + $dx}] [expr {$y0 + $dy}] } return $result } # Scales a unit figure into a given row,col cell proc ScaleShift {row col xy} { set drow 100 set dcol 80 set sx 50 ;# Scale factor in x set sy 40 set x0 [expr {($col + .5) * $dcol}] set y0 [expr {($row + .5) * $drow}] set result {} foreach {dx dy} $xy { lappend result [expr {$x0 + $sx*($dx-.5)}] [expr {$y0 + $sy*($dy-.5)}] } return $result } # DoString -- shows a whole string as semaphore proc DoString {str} { global type .c delete all set alpha 1 ;# In alpha by default set row [set col 0] ;# Initial position set max_col [expr {[winfo width .c] / 80}] ;# Wrap column set max_col 4 foreach letter [split $str ,] { puts "calling Flags: $letter" Flags $letter $row $col foreach {row col} [NextCell $row $col $max_col] break } .c config -scrollregion [.c bbox all] .c yview moveto 1 } proc NextCell {row col max_col} { if {[incr col] >= $max_col} { return [list [incr row] 0] } return [list $row $col] } proc Tracer {args} { DoString $::mytext } ################################################################ # Put up our gui: set type flags canvas .c -highlightthickness 0 -bd 2 -relief raised -width 300 -height 400 \ -yscrollcommand {.sb set} scrollbar .sb -orient vertical -command {.c yview} entry .title -font {Times 18 bold} -relief raised frame .f label .lbl -text "Type text to see" entry .e -textvariable mytext pack .title -side top -fill x pack .e .f -side bottom -fill x # pack .sema .flag -in .f -side right # pack .lbl -in .f -side left pack .sb -side right -fill y pack .c -side top -fill both -expand 1 bind .c <2> [bind Text <2>] ;# Enable dragging w/ button 2 bind .c <B2-Motion> [bind Text <B2-Motion>] bind .c <Configure> Tracer bind all <MouseWheel> {.c yview scroll [expr {-%D/120}] units} update trace variable mytext w Tracer set mytext "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16" .title insert end "Your name here..." focus .e .e icursor end .e select range 0 end