Common documentation

Module with useful classes and functions.

class mvctools.common.Color

TODO: Enhanced version of pygame.Color.

class mvctools.common.cursoredlist(iterator, cursor=0)

Enhanced list with a cursor attribute

Parameters:
  • iterator (any iterable) – Iterator to build the list from
  • pos (int) – Initial cursor value (default is 0)
dec(dec)

Decrement the cursor and return the new current object.

Parameters:dec (int) – Number of decrementation of the cursor
get(default=None)

Get the current object.

inc(inc)

Increment the cursor and return the new current object.

Parameters:inc (int) – Number of incrementation of the cursor
set(index)

Set the cursor to an arbitrary index value.

class mvctools.common.xytuple

Tuple for x,y coordinates and their transformations.

This class supports the following operators:
  • addition and inplace addition (+, +=)
  • substraction and inplace substraction (-, -=)
  • multiplication and inplace multiplication (* , * =)
  • division and inplace division (/, /=)

These are all term-to-term operations. Hence, the argument has two be a two-elements iterable. They all return an xytuple.

Also, the absolute value operation is supported (abs). It returned a float corrsponding to the norm of the coordinates.

To apply a specific function on both coordinates, use the method map. It returns an xytuple.

__abs__()

Return a float, the norm of the coordinates.

__add__(it)

Add a 2-elements iterable and return an xytuple.

__div__(it)

Divide by a 2-elements iterable and return an xytuple.

__iadd__(it)

Add a 2-elements iterable and return an xytuple.

__idiv__(it)

Divide by a 2-elements iterable and return an xytuple.

__imul__(it)

Product by a 2-elements iterable and return an xytuple.

__isub__(it)

Substract a 2-elements iterable and return an xytuple.

__mul__(it)

Product by a 2-elements iterable and return an xytuple.

__neg__()

Return the additive inverse of an xytuple.

__sub__(it)

Substract a 2-elements iterable and return an xytuple.

map(func)

Map the coordinates with the given function a return an xytuple.

Previous topic

Welcome to pygame-mvctools documentation!

Next topic

Control documentation

This Page