Ruby/Tk: How to colorize a Treeview?

I have an item in my Treeview that I want to highlight. I have this
code:

require ‘tk’

tree = Tk::Tile::Treeview.new.pack

tree.insert(’’, ‘end’, :text => ‘blah blah’, :tags => [‘important’])

tree.tag_configure(‘configure’, ‘important’, :background => ‘yellow’)

Tk.mainloop

But the item isn’t shown with its background painted in yellow.

I took that code from:

http://www.tkdocs.com/tutorial/tree.html#appearance

That article mentions this bug in Ruby/Tk.

Is it possible to add some code in Ruby to fix the bug?

(I’m using Tk 8.4, Tile, and Ruby 1.8.7p174, Ubuntu.)

From: Albert S. [email protected]
Subject: Ruby/Tk: How to colorize a Treeview?
Date: Sun, 21 Mar 2010 13:48:11 +0900
Message-ID: [email protected]

tree.tag_configure(‘configure’, ‘important’, :background => ‘yellow’)
(snip)
I took that code from:

http://www.tkdocs.com/tutorial/tree.html#appearance

That article mentions this bug in Ruby/Tk.

Please try “tree.tag_configure(‘important’, :background => ‘yellow’)”.
I think the bug is already fixed (at least, on the latest Ruby/Tk).

Hidetoshi NAGAI wrote:

From: Albert S. [email protected]
Subject: Ruby/Tk: How to colorize a Treeview?
Date: Sun, 21 Mar 2010 13:48:11 +0900
Message-ID: [email protected]

tree.tag_configure(‘configure’, ‘important’, :background => ‘yellow’)
(snip)
I took that code from:

http://www.tkdocs.com/tutorial/tree.html#appearance

That article mentions this bug in Ruby/Tk.

Please try “tree.tag_configure(‘important’, :background => ‘yellow’)”.
I think the bug is already fixed (at least, on the latest Ruby/Tk).

Thanks. Upgrading Ruby/Tk isn’t a viable solution for me because I can’t
force my users to upgrade theirs.

Well, this isn’t critical. I can live without this feature.

(BTW, I’m using the most recent Ruby 1.8 Ubuntu provides, which is
1.8.7.174, and the bug is there.)

Anyway, thanks, Hidetoshi. I appreciate it that you’re here to answer
our questions.

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