graphics/LD_Objects.py
branchpython3
changeset 3759 f713566d5d01
parent 3752 9f6f46dbe3ae
--- a/graphics/LD_Objects.py	Fri Oct 28 15:19:24 2022 +0800
+++ b/graphics/LD_Objects.py	Fri Oct 28 17:01:10 2022 +0800
@@ -23,6 +23,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 
+from functools import cmp_to_key
+from operator import eq
 import wx
 
 from graphics.GraphicCommons import *
@@ -157,7 +159,7 @@
             for connect in self.Connectors:
                 connect_pos = connect.GetRelPosition()
                 connect.SetPosition(wx.Point(connect_pos.x, connect_pos.y - miny))
-        self.Connectors.sort(lambda x, y: cmp(x.Pos.y, y.Pos.y))
+        self.Connectors.sort(key=cmp_to_key(lambda x, y: eq(x.Pos.y, y.Pos.y)))
         maxy = 0
         for connect in self.Connectors:
             connect_pos = connect.GetRelPosition()