Teek::Widget Class
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 ↑
bind(event, *subs, &block)
Bind an event on this widget.
Parameters
eventString— Tk event namesubsArray<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 argumentskwargs— 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
grid(**kwargs)
Grid this widget.
Parameters
kwargs— options passed to the Tk grid command
Returns self
initialize(app, path)
Returns Widget — a new instance of Widget
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
eventString— Tk event name
Returns void
See also
Attributes ↑
app [R]
Returns the value of attribute app.
path [R]
Returns the value of attribute path.