Teek::UI::Image Class
A DSL-declared image, backed by teek core’s Teek::Photo (which
owns the underlying Tk image’s GC lifetime - see its own docs).
Declared via WidgetDSL#image at build time - its Tcl image name
is allocated purely in Ruby, no interpreter needed yet (same shape
as Var’s own Tcl variable name), so it can be captured as a
widget’s image: option (or a later handle.configure(image: ...)
value) before realize even happens. The real Teek::Photo - and
the actual file load - only exists at #realize.
to_s returns the Tcl name (matching Teek::Photo’s own
convention), so passing an Image directly as an image: option
value works through teek’s ordinary option-value serialization -
no special-casing needed anywhere in the widget DSL for it.
Inherits: Object
Instance Methods ↑
photo
Returns Teek::Photo — the live, GC-owned Tk photo image, loaded
from the file path this was declared with
@raise NotRealizedError before realize
realize(app)
Loads the backing Teek::Photo from this image’s file path.
Called once by Session#realize, before the widget tree
realizes, so any widget’s image: option already resolves to a
real, loaded image by the time it’s created.
@api private
to_s
Returns String — the Tcl image name - lets this be passed
directly as a widget's `image:` option, at build time or via a
later `handle.configure(image: ...)`, the same way
Teek::Photo itself already can be.
Attributes ↑
name [R]
Returns String — the Tcl image name