0

I'm building an admin panel using Tkinter in Python. I'm using ttk. Treeview to display computed salary data. I call tree.insert(...) and the data is inserted — I can confirm the values by calling:

tree.get_children()
tree.item(child_id)["values"]

The rows exist. But visually, the Treeview remains blank — no rows are shown.

Test rows inserted at startup show correctly. Computed rows show in console but not in the Treeview. Column count and value count match (9 columns). No errors are thrown.

Here's how I define the Treeview:

tree = ttk.Treeview(parent, columns=(...), show="headings")
tree.pack(fill="both", expand=True)
for col in columns:
tree.heading(col, text=col)
tree.column(col, width=130, anchor="center")

What I’ve tried:

-Wrapping the Treeview in a dedicated Frame

-Calling update_idletasks()

-Validating the inserted value count

-Verifying with .get_children() and .item() that data exists

What else could cause rows to be invisible even when the data is confirmed present?

1 Answer 1

1

Turns out the problem was that I accidentally created two different Treeview widgets.

One Treeview was created and packed into the GUI (which is the one actually visible), and then a second salary_tree was defined later in the code — this second one was used for all .insert() calls.

So while the data was being inserted, it was going into a different Treeview instance that wasn’t displayed on screen.

Once I deleted the second (duplicate) salary_tree = ttk.Treeview(...) line, and made sure all insertions went into the original Treeview, the rows displayed correctly.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.