text tag configuration in rubytk

L

Len Lawrence

In the following code snippet I am trying to configure a tagged field
in a text widget but cannot figure out the syntax for the command.
The rubytk_en site seems to be down permanently so I have to ask
here. None of the other online documentation goes deep enough to
cover this topic.

month = Calendar::Month[k-1]
text = sprintf( " %3s %02d : %s\n", month, d, @@diary[j]
[2] )
$w.insert( 'end', text )
entry += 1
colour = Coding[Codex
Code:
][2]
$w.addtag( 'zib', "#{entry.to_s}.14", 'end' )

What I wish to do is translate the Tcl command

$w tag configure "zib" -foreground $colour

to rubytk.  Any pointers?

I found the addtag method by trial and error but that approach did not
work for configure; i.e. there is no configuretag method.

Len
 
L

Len Lawrence

In the following code snippet I am trying to configure a tagged field in
a text widget but cannot figure out the syntax for the command. The
rubytk_en site seems to be down permanently so I have to ask here. None
of the other online documentation goes deep enough to cover this topic.

month = Calendar::Month[k-1]
text = sprintf( " %3s %02d : %s\n", month, d, @@diary[j]
[2] )
$w.insert( 'end', text )
entry += 1
colour = Coding[Codex
Code:
][2]
$w.addtag( 'zib', "#{entry.to_s}.14", 'end' )

What I wish to do is translate the Tcl command

$w tag configure "zib" -foreground $colour

to rubytk.  Any pointers?

I found the addtag method by trial and error but that approach did not
work for configure; i.e. there is no configuretag method.
[/QUOTE]

Some more trial and error gave this, which works:

text = .....
$w.insert( 'end', text )
entry += 1
endpoint = sprintf( "%d.%d", entry, text.length )
colour = .....
$w.addtag( (t = "zib#{entry}"), "#{entry.to_s}.14", endpoint )
$w.tag_configure( t, 'foreground' => colour )

Len
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,661
Latest member
sxarexu

Latest Threads

Top