MicroPython Cookbook
上QQ阅读APP看书,第一时间看更新

How it works...

The pixels attribute understands when you set values using the slice method. However, it expects that if you set the color for two pixels, then you should provide a list of two color values, as was done in the first example.

In Python, we can reduce this repetition by taking a list of the color values and multiplying it by the required number of values. This is the approach that is used to set the three pixels to the color green.