[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] euclid.Vector2 to pygame coordinate tuple shortcut?



I don't have that package, but from what I see, it looks like this should work:
pygame.draw.circle(self.game.screen, self.color, tuple(self.loc), self.radius )

-FM

On Wed, Dec 24, 2008 at 11:36 PM, Jake b <ninmonkeys@xxxxxxxxx> wrote:
> I lost this shortcut, and can't find it googling. example: you have
> function that gets called like so:
>
>    f2(1, (2,3), 3)
>
> ( like pygame.draw.circle() has a tuple for coordinates ). you can either do:
>
> pygame.draw.circle(self.game.screen, self.color, (self.loc.x,
> self.loc.y), self.radius )
>
> Or, what is the syntax to expand as tuple? it was something like: (
> where self.loc is a euclid.Vector2 )
>
>    pygame.draw.circle(self.game.screen, self.color, *self.loc, self.radius )
>
> Messing with IDLE, trying to figure it out, I'm able to get it to work
> if there is *only* one argument, the tuple:
>
>    f(*v) maps to f(v.x, v.y)
>
> thanks,
> --
> Jake
>