[Python-Dev] ttk.Treeview.insert() does not allow to insert item with iid=0 (original) (raw)
MRAB python at mrabarnett.plus.com
Fri Mar 16 20:39:06 EDT 2018
- Previous message (by thread): [Python-Dev] ttk.Treeview.insert() does not allow to insert item with iid=0
- Next message (by thread): [Python-Dev] ttk.Treeview.insert() does not allow to insert item with iid=0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2018-03-16 20:22, Terry Reedy wrote:
On 3/16/2018 6:54 AM, Игорь Яковченко wrote: [snip]
There is no item with such iid. This item has autogenerated iid just like it's not specified. I investigated problem and found that in ttk.py, Treeview.insert(... iid=None, ...) in method's body has a check: if iid: res = self.tk.call(self.w, "insert", parent, index, "-id", iid, *opts) else: res = self.tk.call(self.w, "insert", parent, index, *opts) It means that if iid is "True" then use it else autogenerate it. Maybe there should be "if iid is not None", not "if iid"? Or there are some reasons to do check this way? It might be that accepting '' as an iid would be a problem. Our current tkinter expert, Serhiy Storchaka, should know. If so, "if iid in (None, '')" would be needed. The root of the tree has the iid ''.
- Previous message (by thread): [Python-Dev] ttk.Treeview.insert() does not allow to insert item with iid=0
- Next message (by thread): [Python-Dev] ttk.Treeview.insert() does not allow to insert item with iid=0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]