from tkinter import ttk
from tkinter import *
import sqlite3
class Product:
db_name = 'database_escuela.db'
def __init__(self, window):
# Se crea una ventana
self.wind = window
self.wind.title('Aplicacion Escuela Ministerio Teocratico')
# Crear un Frame o contendor
frame = LabelFrame(self.wind, text = 'Registro de Estudiantes de la Escuela Ministerio
Teocratico')
frame.grid(row = 0, column = 0, columnspan = 10, pady = 20, padx = 20)
# Tabla
self.tree = ttk.Treeview(height = 10, columns = 3)
self.tree.grid(row =0, column = 0, columnspan = 5)
self.tree.heading('#0', text = '1er Nombre', anchor = CENTER)
self.tree.heading('#1', text = '2do Nombre', anchor = CENTER)
self.tree.heading('#2', text = '1er Apellido', anchor = CENTER)
if __name__ == '__main__':
window = Tk()
application = Product(window)
window.mainloop()
Me aparece este error:
Traceback (most recent call last): File "prueba10.py", line 30, in <module> application = Product(window) File "prueba10.py", line 25, in __init__ self.tree.heading('#2', text = '1er Apellido', anchor = CENTER) File "C:\Users\Juan Carlos Pantoja\AppData\Local\Programs\Python\Python38-32\lib\tkinter\ttk.py",line 1303, in heading return _val_or_dict(self.tk, kw, self._w, 'heading', column) File "C:\Users\Juan Carlos Pantoja\AppData\Local\Programs\Python\Python38-32\lib\tkinter\ttk.py",line 297, in _val_or_dict res = tk.call(*(args + options)) _tkinter.TclError: Column #2 out of range