我一直在写一个竞赛条目,试图用树莓皮感应帽做一个mp3播放器。我用pygame.mixer.music
添加了一个play函数,我想让模式显示在屏幕上(从选择中随机生成),但是当我运行程序时,我只得到以下错误:
Traceback (most recent call last):
File "/home/pi/Astro Pi/MP3 Player/player.py", line 90, in <module>
display()
File "/home/pi/Astro Pi/MP3 Player/player.py", line 65, in display
sense.set_pixels(pattern_one)
File "/usr/lib/python2.7/dist-packages/sense_hat/sense_hat.py", line 268, in set_pixels
if len(pix) != 3:
TypeError: object of type 'int' has no len()
你能帮忙吗?这是我的全部代码。。。在
^{pr2}$
我认为这是因为你在你的模式矩阵中使用了零,所以需要使用RGB列表。尝试将这些零设置为某种颜色(我猜是黑色),如以下参考: https://pythonhosted.org/sense-hat/api/#set_pixels
相关问题 更多 >
编程相关推荐