Updated 2018-05-22 16:14:18 by bll

brad.lanam.comp _at_ gmail.com

Currently unemployed.

Tcl/Tk, C, perl, php, shell, MySQL/MariaDB, HTML, CSS, porting, legacy systems, system administration.

website:

https://gentoo.com/ (registered 1992-03-26) No, this is not gentoo linux, they're at http://gentoo.org/ (registered 1999-10-04).

https://ballroomdj.org/

CV

  • B.S. Computer Science, minor in mathematics.
  • Debit/Credit processing system.
    • Seattle installation: Running on OS/2 in 35 grocery stores, all communicating to the same software running on SCO Unix at corporate which sent the transactions on to the bank.
    • California drug store: Handled 14 transactions per second processing checks.
  • Wrote the communications protocol for the California Smog Check 2 project.
  • Wrote the online epub reader for Apress utilizing Sphinx Search to search the entire Apress library.

Projects:

BallroomDJ: A ballroom music player written in tcl/tk.

SourceForge: https://sourceforge.net/u/bll123/profile/

All code I post here is under the MIT License.

Created Pages:

Major Contribution:


Bugs filed:

Window screen height/width returns height/width of primary display: [1]

Putting a window into fullscreen mode moves the window to the primary display: [2]

Workaround:
    set vx [winfo vrootx .] ; # so we can tell if monitors are 1-2 or 2-1
    set vy [winfo vrooty .]

    wm state $w zoomed
    set nsh [winfo reqheight $w]
    set nsw [winfo reqwidth $w]
    wm overrideredirect $w yes
    if { $vx < 0 } {
      set nx $vx
    } else {
      set sw [winfo screenwidth .]
      set nx [expr {$sw+1}]
    }
    set ny 0
    wm geometry $w ${nsw}x${nsh}+$nx+0

Workaround for bug in 8.6.3 tk_getOpenFile:
  # work around 8.6.3 bug
  if { $fn == {} || [regexp {^after#} $fn] } {
    return
  }

Notes:

Using update rather than update idletasks prevents windows from putting the tk window into a not responding state.

Windows starts up the tcl scripts with wish, which uses the wish icon. Starting with tclsh uses the icon set using 'wm iconbitmap'. So to get the wanted icon to display, restart the program with tclsh.
package require Tk

set tclsh [info nameofexecutable] 
if { [regexp {wish\d*.exe} $tclsh] } { 
  regsub {wish\d*.exe} $tclsh tclsh.exe tclsh 
  exec $tclsh [info script] & 
  exit 
} 
wm iconbitmap . -default [file join $myimages bdj_icon.ico] 

wm iconphoto only works with .gif files on windows, and only seems to allow a single image (despite the documentation).

ActiveState Tcl/Tk doesn't seem to get a dock icon. Everything seems to work with MacPorts Tcl/Tk.

Mac OSX application name in menubar:

a) Symlink the application name to the wish executable.

a1) It seems that CFBundleExecutable has to be the same name as the application name (this seems a bit odd -- the python examples don't have this issue).

a2) I needed to run wish during the installation to get the real wish executable path. It seems that stdout gets completely lost. I had to open a file and save the output there, then I could retrieve the information from the output file in the postinstall script.

a3) info nameofexecutable will return the symlink in (a).

b) Create Resources/Scripts/AppMain.tcl. This script is executed when (a) is run. Always. So I use:
set script [file normalize [file join \
    [file dirname [file dirname [file dirname [info script]]]] \
    MacOS MyApp.tcl]]

if { $argc > 0 } {
  set script [lindex $::argv 0]
  set ::argv [lrange $::argv 1 end]
}

source $script

so that the appropriate script is run. This does have the advantage that the application name in the menubar stays intact.

In general (from what I've read) it seems that the python users using the symlink trick have fewer problems getting their application name in the menubar. CFBundleExecutable doesn't have to match the application name, there's no startup script. Why is tk more complicated?

Why shrinking a window doesn't shrink the widget you want it to: https://groups.google.com/forum/#!topic/comp.lang.perl.tk/ZYD71t2tYDk

It would be nice if there was a way to configure this. Why doesn't shrinking the window honor the '-expand true' flags?

(Expanding the window honors the weight/expand flags. Shrinking the window uses the packing order of the widgets)