4
4
import atexit
5
5
6
6
7
+ try :
8
+ xrange (0 )
9
+ except NameError :
10
+ xrange = range
11
+
12
+
7
13
def Color (red , green , blue , white = 0 ):
8
14
"""Convert the provided red, green, blue color to a 24-bit color value.
9
15
Each color component should be a value 0-255 where 0 is the lowest intensity
@@ -27,7 +33,7 @@ def __getitem__(self, pos):
27
33
# Handle if a slice of positions are passed in by grabbing all the values
28
34
# and returning them in a list.
29
35
if isinstance (pos , slice ):
30
- return [ws .ws2811_led_get (self .channel , n ) for n in range ( pos .indices (self .size ))]
36
+ return [ws .ws2811_led_get (self .channel , n ) for n in xrange ( * pos .indices (self .size ))]
31
37
# Else assume the passed in value is a number to the position.
32
38
else :
33
39
return ws .ws2811_led_get (self .channel , pos )
@@ -40,7 +46,7 @@ def __setitem__(self, pos, value):
40
46
# LED data values to the provided values.
41
47
if isinstance (pos , slice ):
42
48
index = 0
43
- for n in range ( pos .indices (self .size )):
49
+ for n in xrange ( * pos .indices (self .size )):
44
50
ws .ws2811_led_set (self .channel , n , value [index ])
45
51
index += 1
46
52
# Else assume the passed in value is a number to the position.
0 commit comments