# Text tag configuration in rubytk

**URL:** <https://www.ruby-forum.com/t/text-tag-configuration-in-rubytk/143923>\
**Category:** Ruby\
**Created:** [July 23, 2008, 10:06pm UTC](https://www.ruby-forum.com/t/text-tag-configuration-in-rubytk/143923 "2008-07-23T22:06:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tarazed](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed8c4c/32.png) [@tarazed](https://www.ruby-forum.com/u/tarazed)\
**Post date:** [July 23, 2008, 10:06pm UTC](https://www.ruby-forum.com/t/text-tag-configuration-in-rubytk/143923/1 "2008-07-23T22:06:08Z")

</div>

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.

Len

---

<div class="post-metadata">

**Author:** ![tarazed](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed8c4c/32.png) [@tarazed](https://www.ruby-forum.com/u/tarazed)\
**Post date:** [July 23, 2008, 11:40pm UTC](https://www.ruby-forum.com/t/text-tag-configuration-in-rubytk/143923/2 "2008-07-23T23:40:36Z")

</div>

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 )

```

Len
