Text tags and hypertext

graham.matthews@maths.anu.edu.au
9 Jan 1995 22:24:04 GMT

I have been trying to set up a kind of small X11 hypercard.
To do this I want to have text widgets with words tagged so
that when the user releases the first button on that word, some
action is invoked.

The docs says that this is possible, but provide no examples.
None of the demos have any real examples either. So I have
been trying unsuccessfully to do this as follows,

def do_click():
print 'got a click'

w_out = ScrolledText( ... )
w_out.insert('end', "This ")
here = w_out.index('end')
w_out.insert('end', "is")
w_out.tag_add( {'<ButtonRelease-1>': do_click}, here, 'end')
w_out.insert('end', " a link")

This is supposed to set up a document with the words "This is a
link" in it, with the word "is" being "active". Now either my tag
construction is wrong, or I need to apply it over a range of
characters, or both.

Anyone know what I am doing wrong?

graham

--
                    Though the days come and go
                     There is one thing I know
                  I've still got the blues for you