Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23160

migrated from pyglet 1.5 to 2.0 and now can't use colors. I looked at the documentation and it says use a tuple but tuples give me this error?

$
0
0
import pyglet as pyprint(py.version)# Create a windowwindow = py.window.Window(width=500, height=500)circle = py.shapes.Circle(250, 250, 30, (255,255,0))@window.eventdef on_draw():    window.clear()    circle.draw()

this is the error:

    circle = py.shapes.Circle(250, 250, 30, (255,255,0))             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "C:\Users\assis\anaconda3\Lib\site-packages\pyglet\shapes.py", line 580, in __init__    colors=('Bn', self._rgba * self._num_verts),                  ~~~~~~~~~~~^~~~~~~~~~~~~~~~~TypeError: can't multiply sequence by non-int of type 'tuple'PS C:\Users\assis\OneDrive\Documents\interpolation> 

note: this error is within the shapes header in the library, so not in my code. basically I'm using the wrong method to upgrade a color or set a color in a shape, but in the documentation it doesn't seem like it's different from 1.5. I don't know what I'm doing wrong but clearly I'm missing something. please help me

I tried to migrate from 1.5 to 2.0 in pyglet and it created issues with updating colors because colors are tuples. the problem seems to be that in the library it wants to multiply the tuple with something else which doesn't work:

line 580 in shapes.py

self._vertex_list = program.vertex_list(self._segments*3, GL_TRIANGLES, self._batch, self._group,                                                colors=('Bn', self._rgba * self._num_verts),                                                translation=('f', (x, y) * self._num_verts))        self._update_vertices()

Viewing all articles
Browse latest Browse all 23160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>