0

I have a tuple of constants:

WIN = 640, 360, "Example", False, 'tool' # x, y, title, resizable, style

And now to use it I have to type in this:

app = pyglet.window.Window(WIN[0], WIN[1], WIN[2], WIN[3], WIN[4])

Is there a method to split tuple into separate elements like this:

app = pyglet.window.Window(WIN.extract()) ?

3 Answers3

0

Use star unpacking.

app = Window(*args) 
jwilner
  • 5,840
  • 6
  • 29
  • 46
0

Use this

app = pyglet.window.Window(*WIN) 
Sailesh Kotha
  • 1,659
  • 1
  • 17
  • 27
0

app = pyglet.window.Window(*WIN)

Julien Spronck
  • 14,079
  • 4
  • 41
  • 51