import pyglet as py
print(py.version)

# Create a window
window = py.window.Window(width=500, height=500)

circle = py.shapes.Circle(250, 250, 30, (255,255,0))

@window.event
def 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()
0

There are 0 best solutions below