So I'm working on an embedded user editable table in tkinter. I'd like to give the PlateLayout class a custom set of rows instead of the default 1,2,3...
import Tkinter as tk
from tkintertable.Tables import TableCanvas
class PlateLayout:
def __init__(self, parent):
self.parent = parent
def make_frame(self):
self.the_frame = tk.Frame(self.parent)
self.the_frame.pack()
def make_table(self):
self.the_table = TableCanvas(self.the_frame, rows=8, cols=12)
self.the_table.createTableFrame()
def make_all(self):
self.make_frame()
self.make_table()
root_win = tk.Tk()
app = PlateLayout(root_win)
app.make_all()
root_win.mainloop()
I've seen screen shots of renamed columns, but haven't found a reference as to how to do this programmatically.
This is referenced from https://code.google.com/p/tkintertable/wiki/Usage#Change_column_labels
A quick change to your code will let you set custom labels;
....
def make_table(self):
self.the_table = TableCanvas(self.the_frame, rows=8, cols=12)
# Lets peek at the current labels, delete in production
print self.the_table.model.columnlabels
self.the_table.model.columnlabels['1'] = "Custom Col"
self.the_table.createTableFrame()
....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With