Recent Changes - Search:

TkFind

Tk::find

Tk::find is a simple but powerful command that allows you to search for windows. It's signature is:

  proc Tk::find {{window .} {name *} {class *} {script {}}}

It searches the widget tree starting from window matching the patterns for [winfo class/ name].

If called with no arguments it will return a list of all widget paths in Tk.

If a name is given, then only windows matching [winfo name] are processed, except when name begins with a dot. In that case the match is performed on the entire path.

If a class is given, then only windows matching [winfo class] are processed.

If a non-empty script is givin then for each matching window the script is evaluated, after the window name is substituted for %W.

Examples

  # Search for any widget name starting with big.
  Tk::find . big*

  # Search only in .myapp
  Tk::find .myapp big*

  # Make all buttons 0 padded.
  Tk::find . * Button { %W conf -padx 0 -pady 0 }

  # Set background.
  Tk::find . big* * { catch { %W conf -bg Blue } }

  # Pink only entries who are descendants of "subfr" in ".myapp"
  Tk::find .myapp .*.subfr.* Entry { %W conf -bg Pink }

Edit - History - Print - Recent Changes - Search
Page last modified on January 05, 2010, at 03:35 PM