Text tag configuration in rubytk

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][i]

[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.


On Wed, 23 Jul 2008 20:00:44 +0000, Len L. wrote:

  colour = Coding[Codex[code]][2]

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 )


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs