[Tkinter-discuss] multicolumn list/tree with images
Michael Lange
klappnase at web.de
Thu Feb 15 05:32:30 EST 2018
Hi,
On Wed, 14 Feb 2018 01:26:20 +0100
<c.buhtz at posteo.jp> wrote:
> On 2018-02-14 01:14 <c.buhtz at posteo.jp> wrote:
> > But I need images as values. I don't want to use column '#0' for
> > images. Images should appear in the second column for example.
>
> A workaround would be to keep the '#0' column with the image.
> But I need to remove the tree space (some pixel on the left of the
> picture) because I don't need a tree. But show='headings' would remove
> the complete '#0' column with the image.
>
> I need an image in each list row as small button. The user can use this
> as a flag to mark some rows.
I have a similar setup in one of my apps, where I use a "checkbutton"
image in col #0 so the user can select or deselect a list entry. It
works, but is not perfect, though: there does not seem to be a way to
make only the "checkbutton" icon sensitive to mouse clicks, so the
"checkbutton's" state changes even when the user clicks somewhere in col
#0 next to the icon. And the "active rectangle" appears only as a tiny
dotted rectangle between the icon and the text which is in col #1.
The setup I use, which apart from the above issues I think looks good
enough, is
treeview.configure(show=('tree', ), columns=('foobar',))
treeview.column('#0', width=35, stretch=0)
Best regards
Michael
.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
Live long and prosper.
-- Spock, "Amok Time", stardate 3372.7
More information about the Tkinter-discuss
mailing list