Teek API Documentation

Thin wrapper around a Tk widget path. Holds a reference to the App and the widget’s Tcl path string.

Instances are interchangeable with plain strings anywhere a widget path is expected thanks to #to_s returning the path.

Created via App#create_widget:

Inherits: Object

Instance Methods

==(other)

bind(event, *subs, &block)

Bind an event on this widget.

Parameters
  • event String — Tk event name
  • subs Array<Symbol, String> — substitution codes

Returns void

@yield called when the event fires

See also

command(*args, **kwargs)

Invoke a widget subcommand. Prepends the widget path as the Tcl command.

Parameters
  • args — positional arguments
  • kwargs — keyword arguments mapped to -key value pairs

Returns String — the Tcl result

Example
btn.command(:configure, text: 'New')  # => .ttkbutton1 configure -text {New}
btn.command(:invoke)                  # => .ttkbutton1 invoke

destroy

Destroy this widget and all its children.

Returns void

exist?

Check if this widget still exists in the Tk interpreter.

Returns Boolean

grid(**kwargs)

Grid this widget.

Parameters
  • kwargs — options passed to the Tk grid command

Returns self

hash

initialize(app, path)

Returns Widget — a new instance of Widget

inspect

pack(**kwargs)

Pack this widget.

Parameters
  • kwargs — options passed to the Tk pack command

Returns self

to_s

Returns String — the Tcl widget path

unbind(event)

Remove an event binding from this widget.

Parameters
  • event String — Tk event name

Returns void

See also
Attributes

app [R]

Returns the value of attribute app.

path [R]

Returns the value of attribute path.