Jun-05-2020, 04:46 PM
(Jun-05-2020, 02:16 AM)deanhystad Wrote:from tkinter import * def create_table(window, rows, columns): table = [] for r in range(rows): row = [] for c in range(columns): var = StringVar() entry = Entry(window, textvar=var) entry.grid(row=r, column=c, pady=1, padx=1, ipady=4) row.append(var) table.append(row) return table def paste(event): rows = root.clipboard_get().split('\n') for r, row in enumerate(rows): values = row.split('\t') for c, value in enumerate(values): table[r][c].set(value) root = Tk() root.title("Tolerance changes requests") root.bind_all("<<Paste>>", paste) table = create_table(root, 10, 4) root.mainloop()Now you have to figure out what entry was clicked to get the starting row and column for the paste.
There are probably Tkinter table widgets. Have you looked?
Thank you very much,
Very elegant way to do it and it's a great step ahead for me, I'm stuck here for some time.
I'm away for a few days but I will try to complete the code when I will be back. The clicked entry can be identified as root.focus_get().
About Tkinter widgets, I've tried other ways but this one seems to be the closed to my needs.