Tkinter: multicolumn table widget
MRAB
python at mrabarnett.plus.com
Tue May 31 16:15:04 EDT 2022
On 2022-05-31 19:47, Rich Shepard wrote:
> My web searches haven't helped me learn how to design a read-only scrollable
> table widget displaying rows retrieved from postgres database tables. This
> is for my business development application.
>
> I'm writing a view module that displays my contact history with a named
> person. The person's last and first name are passed to the database tables
> and all the results are displayed in a read-only view.
>
> The view has three vertical sections: person information on top, contact
> methods (phones, email) below that, and a scrollable, multicolumn table
> at the bottom.
>
> The table columns consist of three tk.StringVal() and one tk.Text() which
> usually has multiple rows related to that contact event.
>
> I want to learn how to create the table so each row has the contents of each
> of the four columns and I can scroll down and up to look at the history.
>
> All help is certainly appreciated.
>
Have a look at the tkinter.ttk.Treeview widget; it can be formatted as a
tree hierarchy, its name suggests, or a multi-column tables, but it
doesn't support multi-line text though, as far as I know.
As with the tkinter.Text widget, you'll need to add the scrollbar(s)
separately and then link them.
More information about the Python-list
mailing list