Ruby/Tk: How to colorize a Treeview?

A

Albert Schlef

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.)
 
H

Hidetoshi NAGAI

From: Albert Schlef <[email protected]>
Subject: Ruby/Tk: How to colorize a Treeview?
Date: Sun, 21 Mar 2010 13:48:11 +0900
Message-ID: said:
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).
 
A

Albert Schlef

Hidetoshi said:
From: Albert Schlef <[email protected]>
Subject: Ruby/Tk: How to colorize a Treeview?
Date: Sun, 21 Mar 2010 13:48:11 +0900


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.
 

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
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top