arbalet-project / arbadoc

Documentation, diagrams and wiki for the Arbalet LED table
GNU General Public License v3.0
31 stars 5 forks source link

Error in simulator - nothing is drawn within the simulator window #6

Closed max2play closed 7 years ago

max2play commented 7 years ago

Hi,

I set up everything according to your docs. Using a virtual machine with Debian Wheezy and Gnome.

This is the error message: user@develop: ~/Arbalet/arbapps$ python -m arbalet.apps.colors Exception in thread Thread-2: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner self.run() File "/usr/local/lib/python2.7/dist-packages/arbalet_core-3.0.0-py2.7.egg/arbalet/core/arbasim.py", line 64, in run self.display.fill(color.Color(pixel[0], pixel[1], pixel[2]), ValueError: invalid color argument

The simulator window opens and if I remove the line that produces the error at least the vertical and horizontal lines are drawn. But nothing else happend - tried other demos as well.

Any ideas?

Thanks, Stefan

max2play commented 7 years ago

Found that the value of "pixel" is not useable by the Color function of PyGame. Forcing conversion to integer for the Pixel values solves the problem in /usr/local/lib/python2.7/dist-packages/arbalet_core-3.0.0-py2.7.egg/arbalet/core/arbasim.py:

self.display.fill(color.Color(int(pixel[0]), int(pixel[1]), int(pixel[2])), Rect(w*self.cell_width, h*self.cell_height, self.cell_width, self.cell_height))

Maybe anyone else discovers the same problem - anyway NICE PROJECT!

Hope I could help you with my finding.

Stefan

ymollard commented 7 years ago

They are normally numpy ints, funny your pygame does not accept them. Could you give the output of python -c "import pygame; print(pygame.__version__)"?

Anyway a safe cast is worthy, would you mind commiting your changes and opening a pull request directly on the master branch?

max2play commented 7 years ago

PyGame version is "1.9.1release". Although the numbers of the pixel array look like ints, without the converions it does not work - I will create a pull request for the cast to integer.

ymollard commented 7 years ago

I'm testing on 1.9.1release as well, it's strange. Anyway thanks for the bug report and patch!