From 2e7a978055c2f1a950e663cdac06585bee952fab Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 6 Sep 2017 17:42:10 -0700 Subject: [PATCH 1/2] Use functools.cmp_to_key for sorting children --- wx/lib/agw/customtreectrl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wx/lib/agw/customtreectrl.py b/wx/lib/agw/customtreectrl.py index 478db05e..54abb988 100644 --- a/wx/lib/agw/customtreectrl.py +++ b/wx/lib/agw/customtreectrl.py @@ -5935,8 +5935,8 @@ class CustomTreeCtrl(wx.ScrolledWindow): if len(children) > 1: self._dirty = True - children = six.sort(children, self.OnCompareItems) - item._children = children + from functools import cmp_to_key + children.sort(key=cmp_to_key(self.OnCompareItems)) def GetImageList(self): From 71a46774d1ac37f60a63420c9f418fc396c5b2e0 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 6 Sep 2017 17:56:39 -0700 Subject: [PATCH 2/2] Add changelog item --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 680e055a..529253b9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -70,6 +70,8 @@ Changes in this release include the following: * Add wx.Simplebook class. +* Fix exception in wx.lib.agw.customtreectrl when calling SortChildren. (#463, + #500)