Does tkinter have a table widget?
If the table is read-only and you're using a sufficiently modern version of Tkinter you can use the ttk.Treeview widget.
You can also pretty easily create a grid of Entry
or Label
widgets. See this answer for an example: https://stackoverflow.com/a/11049650/7432
You can use Tkinter's grid.
To create a simple excel-like table:
try:
from tkinter import *
except ImportError:
from Tkinter import *
root = Tk()
height = 5
width = 5
for i in range(height): #Rows
for j in range(width): #Columns
b = Entry(root, text="")
b.grid(row=i, column=j)
mainloop()
You can grab the data by accessing the children of the grid and getting the values from there.
You could use tkintertable. See the wiki how to start using it.
Tkinter doesn't have a built-in table widget. The closest you can use is a Listbox
or a Treeview
of the tkinter's sub package ttk
.
However, you can use tktable, which is a wrapper around the Tcl/Tk
TkTable
widget, written by Guilherme Polo. Note: to use this wrapper library you need first to have installed the original Tk's TkTable
library, otherwise you will get an "import error".