PySimpleGUI / PySimpleGUI/PySimpleGUI

[Bug] In Tree widget, when an `Update` is performed, the optional data provided gets appended to the existing Tree instead of replacing it.

Open
#2,795 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13.8k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

This is a task bug intended to split #2792 into individual issues.
Other bugs will be raised to cover other issues in #2792 .

Currently when the Update parameter is used with the optional values parameter, the new values get appended to the existing instead of replacing it.

Eg:

treedata = sg.TreeData()
treedata.Insert("", '_A_', 'A', [])
treedata.Insert("", '_B_', 'B', [])

layout = [[ sg.Tree(data=treedata, key="_TREE_", ....) ]]
# .... [SNIP] ....
window.FindElement('_TREE_').Update(treedata)

will display the following:

  A
  B
  A
  B

#2792 contains a proposed diff that fixes this (along with other things).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Tree widget's Update path and the proposed diff in issue #2792. Reproduce the example using TreeData with repeated Update calls and confirm that the supplied values replace the existing tree rather than being appended. Done means the displayed tree contains each updated value once.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.