Version 10 of The list of Tk widgets

Updated 2009-05-27 07:58:36 by LGT

Here is a script to display each widget available in Tk. It made the assumption that all widgets begin with a lowercase letter.

 #
 # the dynamic list of Tk widgets
 # 

 puts " Tk version [package require Tk]"
 puts " ----"

 set tkCommands [lsort [info commands "::tk::\[a-z\]*"]] 

 foreach cmd $tkCommands { 
         puts [string range $cmd 6 end]
 }

 exit 

It gives :

 Tk version 8.5.7
 ----
 button
 canvas
 checkbutton
 entry
 frame
 label
 labelframe
 listbox
 mc
 mcmax
 mcmaxamp
 menubutton
 message
 panedwindow
 radiobutton
 scale
 scrollbar
 spinbox
 text
 toplevel

It works only with version 8.5 so far.


JH This completely misses the themed Tk widget set (::ttk::*).


LGT This script tries to correct this :

        #
        # the dynamic list of Tk widgets
        #

        puts " Tk version [package require Tk]"
        puts " ----"

        set tkCommands [lsort [info commands "::tk::\[a-z\]*"]]
        set ttkCommands [lsort [info commands "::ttk::\[a-z\]*"]]

        set allCommands {}

        foreach cmd $tkCommands {
                lappend allCommands [string range $cmd 2 end]
        }
        foreach cmd $ttkCommands {
                lappend allCommands [string range $cmd 2 end]
        }
        foreach cmd $allCommands {
                puts $cmd
        }

        exit 

Category TK