Text class for Pygame
This is copied from my answer to your question "What about my Pong game?".


The Text._size member is only used to create the font, so there is no need to store it in the instance.
Why not make Text a subclass of pygame.sprite.Sprite so that you can draw it using a sprite group?
Lots of code is repeated betwen Text.__init__ and Text.set_value. Why not have the former call the latter?
The Text.__init__ constructor takes many keyword arguments, which you then apply to self.rect like this:

if top: self.rect.top = top
...


The first problem is that the test if top: means that you can't set top to zero. You should write something like this:

if top is not None: self.rect.top = top


But it would be much simpler to use Python's ** keyword argument mechanism to take any number of keyword arguments, and pass them all to Surface.get_rect.


Applying all these improvements yields the following:

class Text(pygame.sprite.Sprite):
    def __init__(self, text, size, color, font=None, **kwargs):
        super(Text, self).__init__()
        self.color = color
        self.font = pygame.font.Font(font, size)
        self.kwargs = kwargs
        self.set(text)

    def set(self, text):
        self.image = self.font.render(str(text), 1, self.color)
        self.rect = self.image.get_rect(**self.kwargs)