Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I insert images into treeview rows?

79 views
Skip to first unread message

Luc

unread,
May 23, 2023, 7:33:12 PM5/23/23
to
I am almost entirely basing the relevant piece of my code on this:

https://wiki.tcl-lang.org/page/Tile+Table

I have changed it, but for the sake of this query, let's assume only
the following changes:



Line 34, insert:

image create photo ::TileTable::iconDIR -file /home/tcl/icons/defaultset/24pixels/dir_icon.png



Line 60, now 61 because we inserted one:

$w.tree insert {} end -values $datum -tag tag[incr lnum]

replace with:

$w.tree insert {} end -image ::TileTable::iconDIR -values $datum -tag tag[incr lnum]


I expected to see the directory icon inserted right before each
treeview item's text, but nothing appears.

Is there a correct way?

--
Luc
>>

D Groth

unread,
May 29, 2023, 11:28:35 AM5/29/23
to
In a table there is no tree column (#0), as it is a table and not a tree see the -show option of ttk::treeview, so column #0 the tree column is hidden, the image you like to display is invisible. If you like to have a treeview with the tree column just use the default.treeview not a table version of it.

Hint: It is usually better if you show a little working code fragment to get an answer here in the news group. In this case I am sure that you would have found out this yourself as you would be very likely start with the default treeview instead of more complex code. To see the tree column just use -show "tree headings" or so.

Best,
Detlef
0 new messages