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
  • 6,348
  • 6
  • 35
  • 47
0

Use this

app = pyglet.window.Window(*WIN) 
Sailesh Kotha
  • 1,939
  • 3
  • 20
  • 27
0

app = pyglet.window.Window(*WIN)

Julien Spronck
  • 15,069
  • 4
  • 47
  • 55