[Python-Dev] ttk.Treeview.insert() does not allow to insert item with iid=0 (original) (raw)
Игорь Яковченко truestarecat at gmail.com
Fri Mar 16 06:54:51 EDT 2018
- Previous message (by thread): [Python-Dev] [RELEASE] Python 3.6.5rc1 is now available for testing
- 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 ]
Hello,
I found a possible bug with ttk.Treeview widget. I'm working on program that uses tkinter UI. I use ttk.Treeview to display some objects and I want to use integer iid of items. For example, I insert a row with treeview.insert(... iid=0, ...). But I encountered a problem when I try to get this item from treeview by iid when iid =0. 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?
Igor Yakovchenko
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Без вирусов. www.avast.ru <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180316/681220e2/attachment.html>
- Previous message (by thread): [Python-Dev] [RELEASE] Python 3.6.5rc1 is now available for testing
- 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 ]