The TkText widget however does not have this option, it makes little
sense to have text ‘This is the text’ so what you have is…
[snipped examples]
The reason is partly due to underlying Tk code and not something we could
just fix in Ruby (at least that’s my understanding and PH says as much
below-- please correct if wrong). More importantly TkText’s “value” is not
just text! I don’t see it mentioned elsewhere in the thread, so I thought
I better point it out.
TkText is a very powerful widget, including ability to insert pictures, use
multiple fonts, colors, etc, and other properties that would be completely
confounded by any attempt to tie the “value” to a string like TkLabel or
TkEntry can do. TkText is almost misleading, maybe should be TkRichText.

The Perl/Tk pocket reference from O’Reilly is a usefull reference, if
somewhat terse. What you are seeing is more an artefact of Tk than Ruby.
I have never been disappointed using man pages at http://www.tcl.tk or with
the sample scripts in RAA.
To Tom Sawyer’s original problem, you’ll have to bind to keystroke event or
some other widget event to capture changes as they happen, if that is your
intent.
sample code to demonstrate:
require ‘tk’
r = TkRoot.new
t = TkText.new(r).pack
a = “”
t.bind(‘Key’, proc{|x| a << x.keysym_num.chr })
r.bind(‘Button-1’, proc{puts a})
Tk.mainloop
Type into text block to generate a, press mouse button in text box to
print. On my machine this generates errors on certain keystrokes, like
Shift, because its keysym_num is out of range for chr – however capital
letters still work, just not smoothly. The proc{} could easily test for
legal values – and process things like delete or cursor movements, etc.
Michael_C_Libby{x(at)ichimunki(dot)com}__
···
On Tuesday 16 July 2002 10:15, Peter Hickman wrote:
my website: http://www.ichimunki.com/ |
____ public key at http://www.ichimunki.com/public.key ____|