how to convert tuple to a "list of single values" ?

S

stef mientki

hello,

The next piece of code bothers me:

ptx, pty, rectWidth, rectHeight = self._point2ClientCoord (p1, p2 )
dc.SetClippingRegion ( ptx, pty, rectWidth, rectHeight )

Because I want to write it in 1 line,
and without the use of intermediate variables (for which I have to
invent names ;-)
like this:

dc.SetClippingRegion ( self._point2ClientCoord (p1, p2 ) )

Now that doesn't work, because
- dc.SetClippingRegion() requires 4 integer parameters
- _point2ClientCoord() returns a tupple of 4 integers

I can't think of a solution,
is there any ?

thanks,
Stef Mientki
 
D

Duncan Booth

stef mientki said:
hello,

The next piece of code bothers me:

ptx, pty, rectWidth, rectHeight = self._point2ClientCoord (p1, p2 )
dc.SetClippingRegion ( ptx, pty, rectWidth, rectHeight )

Because I want to write it in 1 line,
and without the use of intermediate variables (for which I have to
invent names ;-)
like this:

dc.SetClippingRegion ( self._point2ClientCoord (p1, p2 ) )
Try:
dc.SetClippingRegion ( *self._point2ClientCoord (p1, p2 ) )
 
S

stef mientki

thanks Duncan, Matthieu and Ed (offlist),
this is exactly what I was looking for.

cheers,
Stef
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top