• How do I insert images into treeview rows?

    From Luc@21:1/5 to All on Tue May 23 20:31:48 2023
    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


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From D Groth@21:1/5 to Luc on Mon May 29 08:28:30 2023
    Luc schrieb am Mittwoch, 24. Mai 2023 um 01:33:12 UTC+2:
    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


    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)