# LED Shim - ledshim.set\_multiple\_pixels()

**URL:** <https://forums.pimoroni.com/t/led-shim-ledshim-set-multiple-pixels/17309>\
**Category:** Support\
**Created:** [June 11, 2021, 10:00am UTC](https://forums.pimoroni.com/t/led-shim-ledshim-set-multiple-pixels/17309 "2021-06-11T10:00:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fishgotnosole](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/fishgotnosole/32/7883_2.png) [@fishgotnosole](https://forums.pimoroni.com/u/fishgotnosole)\
**Post date:** [June 11, 2021, 10:00am UTC](https://forums.pimoroni.com/t/led-shim-ledshim-set-multiple-pixels/17309/1 "2021-06-11T10:00:12Z")

</div>

Ahoy, shipmates!

New user with his first post here.

It’s regarding the fine [LED Shim](https://shop.pimoroni.com/products/led-shim) product.

When trying to use the _ledshim.set\_multiple\_pixels()_ object from the ledshim module.

It returns the following error:

> AttributeError: ‘module’ object has no attribute ‘set\_multiple\_pixels’

Suggesting that this object is not present in the ledshim library?

Looking at the [ledshim github issue](https://github.com/pimoroni/led-shim/issues) page, there would seem to be others with a similar issue. Other functions seem to be fine.

Is there a fix, or workaround? Is there any word on this, please?

Thanks!

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [June 11, 2021, 10:12am UTC](https://forums.pimoroni.com/t/led-shim-ledshim-set-multiple-pixels/17309/2 "2021-06-11T10:12:14Z")

</div>

```auto
def set_multiple_pixels(indexes, r, g, b):
    for index in indexes:
        ledshim.set_pixel(index, r, g, b)

```

Then do something like this

```auto
        set_multiple_pixels(range(0,11), 255, 0, 0) # Red
        set_multiple_pixels(range(11,16), 255, 140, 0) # Orange
        set_multiple_pixels(range(16,28), 0, 255, 0) # Green
        
        # R R R R R R R R R R R O O O O O G G G G G G G G G G G G

```

---

<div class="post-metadata">

**Author:** ![fishgotnosole](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/fishgotnosole/32/7883_2.png) [@fishgotnosole](https://forums.pimoroni.com/u/fishgotnosole)\
**Post date:** [June 11, 2021, 10:51am UTC](https://forums.pimoroni.com/t/led-shim-ledshim-set-multiple-pixels/17309/3 "2021-06-11T10:51:52Z")

</div>

That’s great, many thanks for that, alpha. That does indeed return a result.  
However, I fear I may have poorly phrased my query.  
Forgiveness please for my newbie-ness! I am still getting to grips with Python. :(

I’m trying to use the _from\_colour_ and _to\_colour_ with the _set\_multiple\_pixels_ object. Like this within a script:

> set\_multiple\_pixels(range(0, 28), from\_colour=(255, 255, 0), to\_colour=(0, 0, 255))

Which throws back the following error:

> TypeError: set\_multiple\_pixels() got an unexpected keyword argument ‘from\_colour’

As noted in the doc for the ledshim [here](http://docs.pimoroni.com/ledshim/).  
Am I not coding correctly? Is the module and or the library possibly needing a refresh?

Thanks again for any help or guidance. It is greatly appreciated.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [June 11, 2021, 11:13am UTC](https://forums.pimoroni.com/t/led-shim-ledshim-set-multiple-pixels/17309/4 "2021-06-11T11:13:56Z")

</div>

That I don’t know? The code above was given to me by Phil @gadgetoid when I asked a similar question.  
[LED Shim as a thermometer - Support - Pimoroni Buccaneers](https://forums.pimoroni.com/t/led-shim-as-a-thermometer/8136/10)
