Updated 2016-04-22 22:10:06 by gold

This page describes how a simple menu program or launch pad can be done with a few easy understandable Tcl/Tk commands. The code works under MSWindows.

Launch pad for launching external programs or other TCL scripts

Variant 1) A row with three buttons. When a button is pressed a commandline string defined at the beginning of the program is executed.

The following script is incomplete, but a start.
 frame .launchpad 
 button .launchpad.button1 -text "Data files" -command {exec command.com /c explorer "C:\\data" &}
 pack .launchpad.button1 -side top -fill x

 button .launchpad.button2 -text "ToDo List" -command {exec command.com /c notepad.exe "C:\\data\\myToDoList.txt" &}
 pack .launchpad.button2 -side top -fill x

 button .launchpad.button3 -text "the third button"
 pack .launchpad.button3 -side top -fill x

 pack .launchpad -side top

 console hide

____ Note: To launch an external program the command
  exec myProg.exe arg1 arg2 &

is used.

Question1: How do I later assign an exec command to a button? How can I dynamically change the behaviour of buttons?

   $buttonName configure -command [list some_other_command and its arguments]

In general, any property set at widget creation time can be changed by the configure sub-command. You can conveniently list all of the options for a widget and their default and current values with:
   foreach option [$widgetName configure] { puts $option }

Question2: Which properties do I have to set that the buttons occupy the whole window width? -fill x is obviously not sufficient.

   -expand yes

See also