[Tutor] Tkinter layout question

Phil phil_lor at bigpond.com
Sat Apr 22 20:38:54 EDT 2017


On Thu, 20 Apr 2017 13:43:07 +0100
Alan Gauld via Tutor <tutor at python.org> wrote:

> If still confused drop a question here.

I hope I'm not over doing the questions here. I'm only posting after hours of experimenting and Internet searching.

How do I create multiple instances of the table on the one frame? I think the table class as presented is not capable of that. If I create multiple instances like this then, of course, I end up with two instances of the same frame.

import tkinter as tk
import table_class

tab = table_class.DisplayTable(tk.Tk(),
                    ["Left","middle","Right"],
                    [[1,2,1],
                    [3,4,3],
                    [5,6,5]],
                    datacolor='blue',
                    cellcolor='yellow',
                    gridcolor='red',
                    hdcolor='black')


second_tab = table_class.DisplayTable(tk.Tk(),
                    ["Left","middle","Right"],
                    [[1,2,1],
                    [3,4,3],
                    [5,6,5]],
                    datacolor='blue',
                    cellcolor='green',
                    gridcolor='red',
                    hdcolor='black')

second_tab.pack(side = tk.LEFT)
tab.pack()

I've tried different pack options including packing onto the parent frame.

-- 
Regards,
Phil


More information about the Tutor mailing list