tcltk-toolkitsubcommand

How are subcommands used in Tcl/Tk?


Reading this entry in the Tcl/Tk online reference i came across this paragraph where it states:

The combobox widget also supports the following ttk::entry widget subcommands (see ttk::entry(n) for details):

  • bbox
  • delete
  • icursor
  • index
  • insert
  • selection
  • xview

I know in this case of the Combobox widget it's comprised partially of an Entry widget but how exactly are subcommands used?


Solution

  • This is the common Tk command structure, and you'll need it to interact with any Tk widget. A subcommand of a widget is done by using the pathname of the object as the base command, then the subcommand you want. E.g.,

    ttk::combobox .cb
    .cb insert 0 "my text"