Don't try to compare Colours.

If any two elements of self._value are equal, sorted tries to sort by the next element in the zipped tuples, resulting in
TypeError: '<' not supported between instances of 'Colour' and 'Colour'
Specifying a key to sort only by the first element prevents this.
This commit is contained in:
Mick Phillips
2018-11-23 12:48:39 +00:00
parent 79ddece4e9
commit 2560dc3c7a

View File

@@ -505,12 +505,12 @@ class PyGauge(wx.Window):
""" Internal method which sorts things so we draw the longest bar first. """
if self.GetBarGradient():
tmp = sorted(zip(self._value,self._barGradient)); tmp.reverse()
tmp = sorted(zip(self._value,self._barGradient), key=lambda x: x[0]); tmp.reverse()
a, b = list(zip(*tmp))
self._valueSorted = list(a)
self._barGradientSorted = list(b)
else:
tmp = sorted(zip(self._value,self._barColour)); tmp.reverse()
tmp = sorted(zip(self._value,self._barColour), key=lambda x: x[0]); tmp.reverse()
a, b = list(zip(*tmp))
self._valueSorted = list(a)
self._barColourSorted = list(b)