osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tkinter: widget to display set returned from database table


On 6/19/2019 6:50 PM, Rich Shepard wrote:
> In a database application I want to design a view for the table rows
> returned from a select statement. Tkinter has a listbox widget and web
> searches suggest that multicolumn listboxes are best based on ttk.Treeview

Right.

> widgets, but my understanding of a treeview is to display a hierarchical 
> set rather than a simple list.

There is no sin is using less than all the features of a widget. 
Anyway, think of the tree having one node, which you can hide (not 
show), representing the table, and n leaves, representing the rows of 
the table, which you do show.

If you sort the selection by some categorical field, then you can make 
the display hierarchical by adding expandable rows for values of the 
sort field.  Think of database reports where summary lines can be 
expanded and contracted.

-- 
Terry Jan Reedy