Anders-Holst / xled_plus

Addons to the XLED package, to create nice effects for Twinkly LED lights
MIT License
32 stars 7 forks source link

show_text - IndexError: list index out of range #15

Closed nmonkee closed 8 months ago

nmonkee commented 1 year ago

IndexError: list index out of range for xled_plus.show_text

% python3 -m xled_plus.show_text "merry xmas" xx.xx.xx.xx
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/show_text.py", line 30, in <module>
    eff = RunningText(ctr, txt.upper(), makecolorlist(len(txt)), size=0.6, speed=0.5)
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/shapes.py", line 772, in __init__
    self.place_text()
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/shapes.py", line 783, in place_text
    size = self.size * (bounds[1][1] - bounds[1][0])
IndexError: list index out of range

from my own utility:

def SetScroller(ip,message):
  if len(ip) > 1:
    print("[+] setting scroller message '",message.upper(),"' on group ",ip)
    ctr = MultiHighControlInterface(ip)
  else:
    print("[+] setting scroller message '",message.upper(),"' on device",ip)
    ctr = HighControlInterface(ip[0])
  ctr.adjust_layout_aspect(1.0)  # How many times wider than high is the led installation?
  eff = RunningText(ctr, message.upper(), [hsl_color(h, 1.0, 0.0) for h in [0.1, 0.7, 0.3, 0.6, 0.8]], size=0.6, speed=0.5)
  eff.launch_movie()
[+] setting scroller message ' MERRY XMAS ' on device ['xx.xx.xx.xx']
Traceback (most recent call last):
  File "/Users/nmonkee/Desktop/Twinkly/Twinkly.py", line 316, in <module>
    SetScroller(args.device,args.message)
  File "/Users/nmonkee/Desktop/Twinkly/Twinkly.py", line 219, in SetScroller
    eff = RunningText(ctr, message.upper(), [hsl_color(h, 1.0, 0.0) for h in [0.1, 0.7, 0.3, 0.6, 0.8]], size=0.6, speed=0.5)
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/shapes.py", line 772, in __init__
    self.place_text()
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/shapes.py", line 783, in place_text
    size = self.size * (bounds[1][1] - bounds[1][0])
IndexError: list index out of range