class Inv(tk.Frame): def __init__(self, parent, controller): tk.Frame.__init__(self, parent) table_frame = tk.LabelFrame(main_frame, bg='yellow', width=640, height=720) tk_table = ttk.Treeview(table_frame, columns=imp_df.columns.values) t_entry = tk.Entry(self, width=100) t_entry.insert(0,"ello") t_entry.pack() t_btn.pack() table_frame.pack(side='right', fill='y', expand=True, anchor='e', ipadx=150) table_frame.pack_propagate(0) tk_table.pack(anchor='center', expand=True, fill='both') tk_table.bind("<<TreeviewSelect>>", self.insert_info) def insert_info(self, event): t_entry.insert(0, "test insert text")I have tried numerous setups, but I cannot call my test entry widget (t_entry) from another function. I am wanting my entry widgets populated with the data that is selected on the tk tree, but when declaring a new function:
def insert_info(self, event): t_entry.insert(0, "test insert text")"t_entry" is never recognized. I understand this code won't work, but I typed it to give an example of what I am trying to achieve.
Solved it unexpectedly.
def insert_info(self, event): t_entry.insert(0, "test insert text")needed to be
def insert_info(self, event): self.t_entry.insert(0, "test insert text")I also had to declare "self" on all my previous widgets to be able to call any widget appropriately.